Home > Backend Development > PHP Tutorial > thinkPHP ajax post向后台传参,后台接收不到

thinkPHP ajax post向后台传参,后台接收不到

WBOY
Release: 2016-06-20 12:32:11
Original
1884 people have browsed it

   $.ajax({
                    type: 'post',
                    url: '__APP__/Wechat/Shulte/gmtim',
                    data: { // 这种方式提交参数
                        'name': result
                    },
                    success: function(msg) {
                        alert(msg);
                    }
                });
ajax执行成功,抓包成功。
public function gmtim(){
C('SHOW_PAGE_TRACE',false);
$this->info();
$name = session('name');
session('miao',$_POST["name"]);
$time=session('miao');
$where['gm_name']=$name;
$data['gm_gtime']=$time;
var_dump($where);
var_dump(session('miao'));

}
后台接受不到,返回空值。


回复讨论(解决方案)

你的 js 代码是写在模板文件中的吗?
你在浏览器中看看这部分代码是否正确!

是写在前台模版中的,其他功能都能正确的执行。url这边也没有问题url(/index.php/Wechat/Shulte/show),客户的账号也能够获取到。

请问楼主现在问题解决了吗

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template