Jquery Ajax Post类型不适用于zend框架IE 7/8


Jquery Ajax Post type not working with zend framework IE 7/8

我在IE8/7中遇到了一个奇怪的问题(一如既往),但这次它提出了zend框架。。下面我已经解释过了。。

问题,

当我在zend框架1.X中使用jquery ajax方法时,如下所示,如果我使用'type: 'POST',那么我的zend控制器将不会按原样检测参数值,而不是显示为空白。。

例如在我的zend控制器中

`echo $this->_request->getParam('aData');` //echo nothing 

但如果我使用类型:"GET",所有参数将在我的zend控制器中显示良好。

echo $this->_request->getParam('aData'); //echoing parameter values
$.ajax({
            type: 'GET',
            dataType: 'json',
            url: "/xhr_process/commentsave/",
            data: aData,
            success:function(aResponse){
                console.log(aResponse);
            }
        });

这只出现在IE 8/7其他所有浏览器都运行良好

感谢思想!!

更新

我已经将CACHE设置为false,它不是成功的

console.log(aData); Object { sCommentText="wewewewew", iComponent="1"}

更新2

我们使用NTML对进行身份验证

$_POST变量在一个子文件夹的IE7中为空

注意post和get方法(getParam()getPost()方法)的区别:

使用岗位:

echo $this->_request->getParam('aData'); //echoes nothing 
echo $this->_request->getPost('aData'); //echoes aData value

使用get:

echo $this->_request->getParam('aData'); //echoes aData value
echo $this->_request->getPost('aData'); //echoes nothing

当您通过ajax将数据作为后变量发送时,您需要将数据提交为url编码的字符串:,还需要将它们在ajax调用中的类型设置为post

  data: "aData="+aData

或者以非常相似的方式作为对象。

  data: {aData: aData}

jQuery将处理将数据正确编码到http文章正文中的问题。

 $.ajax({
      type: 'POST',
      dataType: 'json',
      url: "/xhr_process/commentsave/",
      data: {aData: aData},
      success:function(aResponse){
          console.log(aResponse);
      }
 });
echo $this->_request->getParam('aData'); //echoing parameter values
<script type="text/javascript">
$.ajax({
            type: 'GET',
            dataType: 'json',
            url: "/xhr_process/commentsave/",
            data: {'aData':aData},
            success:function(aResponse){
                console.log(aResponse);
            }
        });
</script>
use this code it will work because i am also using this code for IE7 & 8