Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用zend框架的Jquery ajax请求_Jquery_Ajax_Zend Framework - Fatal编程技术网

使用zend框架的Jquery ajax请求

使用zend框架的Jquery ajax请求,jquery,ajax,zend-framework,Jquery,Ajax,Zend Framework,我提出一个jquery ajax请求,如下所示: $.ajax({ type: 'post', data: '{user : 1234}', url: '../../mycontroller-ajax/sort', success: function (response) { alert(response); } } );

我提出一个jquery ajax请求,如下所示:

$.ajax({
            type: 'post',
            data: '{user : 1234}',
            url: '../../mycontroller-ajax/sort',
            success: function (response) {
                alert(response);
            }
        }
    );
但是,在控制器/动作部分,我首先禁用视图

$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
但如果我回应

$_POST['user'] 
它说索引没有定义

data : {
'user' : 1234
}
肯定会有帮助,但我想你还需要包括:

dataType : 'json'
试试这个

 data: {user : 1234}, 
而不是

data: '{user : 1234}',

数据:{user:1234},
而不是
数据:{user:1234},