当前位置: 代码迷 >> Java Web开发 >> jQuery在IE里 不施行回调函数
  详细解决方案

jQuery在IE里 不施行回调函数

热度:2419   发布时间:2013-02-25 21:13:03.0
jQuery在IE里 不执行回调函数
jQuery.ajax({
type:"get",
  url:"http://api.soningbo.com/resource/comment/location/a5707b0085dc71b1783efc16453fb0bf",
dataType:"json",
success:function(json){
alert("ok!!!!");
},
complete:function(json){},
error:function(){alert('error!');}
});

使用jQuery1.7版本的时候,IE不执行回调函数,用HttpWatch查看时,也没有任何的URL请求。但换成谷歌和火狐时,或者jQuery换成1.4时,又执行回调函数。相当不解。。。(如果想做测试,上面的URL可以直接拿来使用)

------解决方案--------------------------------------------------------
我在我这里测试好好的啊。你是不是没有启动httpwatch,你得点一下Record,这才是启动的啊。我这里每次都有请求的。
<html>
<head>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript">
function getJSON(){
$.ajax({
type:"get",
url:"http://api.soningbo.com/resource/comment/location/a5707b0085dc71b1783efc16453fb0bf?dateTime="+new Date().valueOf(),
dataType:"json",
success:function(json){
alert("ok!!");
},
complete:function(json){},
error:function(){alert('error!');}
});
}
</script>
</head>
<body>
<table>
<tr>
<td>
<input type="button" onclick="getJSON();" value="得到Json值">
</td>
</tr>

</table>


</body>
</html>
  相关解决方案