Php Jquery Ajax帖子类型不适用于zend framework IE 7/8
我在IE8/7中遇到了一个奇怪的问题(和往常一样),但这次它提出了zend框架。。下面我已经解释过了 问题, 当我在zend framework 1.X中使用jquery ajax方法时,如下图所示,如果我使用Php Jquery Ajax帖子类型不适用于zend framework IE 7/8,php,jquery,ajax,zend-framework,Php,Jquery,Ajax,Zend Framework,我在IE8/7中遇到了一个奇怪的问题(和往常一样),但这次它提出了zend框架。。下面我已经解释过了 问题, 当我在zend framework 1.X中使用jquery ajax方法时,如下图所示,如果我使用'type:'POST',我的zend控制器将不会检测到参数值,而是显示为空白 例如,在我的zend控制器中 `echo $this->_request->getParam('aData');` //echo nothing 但如果我使用类型:“GET”,所有参数都会在我的
'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);
}
});
这只出现在IE8/7中,其他所有浏览器都工作正常
感谢你的想法
更新
我已将缓存设置为false,但未成功
console.log(aData); Object { sCommentText="wewewewew", iComponent="1"}
更新2
我们使用NTML进行身份验证请注意post和get方法(
getParam()
和getPost()
方法)的区别:
使用post:
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将数据作为post变量发送时,您需要以URL编码的字符串提交数据:,还需要将它们设置为在ajax调用中键入
post
data: "aData="+aData
或者一个非常相似的方式是作为一个对象
data: {aData: aData}
jQuery将处理将数据正确编码到http post正文中的问题
$.ajax({
type: 'POST',
dataType: 'json',
url: "/xhr_process/commentsave/",
data: {aData: aData},
success:function(aResponse){
console.log(aResponse);
}
});
echo$this->\u请求->获取参数('aData')//回显参数值
$.ajax({
键入:“GET”,
数据类型:“json”,
url:“/xhr\u进程/commentsave/”,
数据:{'aData':aData},
成功:功能(AresResponse){
控制台日志(aResponse);
}
});
使用这段代码它会起作用,因为我也在IE7和IE8中使用这段代码
“您不能将任何数据发布到NTLM和非NTLM身份验证的混合网站。在访问网站的一个NTLM身份验证文件夹后,Microsoft Internet Explorer要求对网站的所有访问进行NTLM身份验证。”
您使用的是什么版本的jquery。。。IE 8及更低版本的2.0下降支持。它是1.7.2。。tnx在aData上发表评论btwdo a console.log在那些浏览器中它给了你什么…请使用ajax方法post:method:“post”请将它粘贴到你的问题中。这真的是一个“=”吗?谢谢你的回答,我已经试过了,还是没有运气。。顺便说一句,我们使用NTML进行身份验证,这可能是问题所在
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