jQuery的AJAX不工作的IE 7/8 [英] Jquery AJAX not working on IE 7/8

查看:146
本文介绍了jQuery的AJAX不工作的IE 7/8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图调试为什么我的AJAX得到的原因/后不工作在IE 7/8

I am trying to debug the reason why my ajax get/post is not working in IE 7/8

下面我code:

$.ajax({type: "POST", dataType:'html',url: "/places/set_member/add/",data: "place_id="+place_id ,
                       beforeSend:  function() {$("<span class='notice'>Saving...</span>").prependTo('body');},
                       success: function(){
                        $.ajax({type:"GET",url:url,success:function(html){$('div.place-list .ui-tabs-panel').html(html);},complete:function(){resetAddThis();}})
                       },
    	       complete: function() {
                            $('span.notice').fadeOut(500);
    		    $('span.notice').remove();
                            }});

现在这工作正常在FF的Safari赢/ Mac的,但不是在IE 7/8

Now this works fine in FF Safari Win/Mac but not in IE 7/8

我下载的小提琴手,看着来电,脚本应该服务器发送数据,然后重新加载它现在有新的更新信息的HTML。正在发生的事情是第一次调用得到一个错误500,但是,随后的HTML后重新加载,并且同样的动作再次完成后,它会发出,以200毫秒,所以它给的外观,它不是储蓄,它只做在第二次尝试。

I downloaded fiddler and watched the calls, the script is supposed to send data the server and then re-load the HTML which now has new updated information. What is happening is the first call gets a error 500 but, then after the html is reloaded, and the same action is done again, it will send, with 200ms, so it give the appearance that it is not saving, which it does only on the second try.

有什么我做错了,什么我需要补充的吗?这是一个PHP循环,所以该功能被应用到相同的链路上20-30项在页面上。

Is there something I am doing wrong, or something I need to add? This is a php loop so this function is being applied to the same link on 20-30 items on the page.

推荐答案

IE缓存中未POST类型的所有Ajax调用。我发现,最好是让所有Ajax调用POST避免IE这样做,即使你张贴空的数据。

IE caches all ajax calls which are not POST type. I have found that it is best to make all Ajax calls POST to avoid IE doing this, even if you post empty data.

或者,你可以做@redsqaure如下建议和做到这一点:

Or you can do as @redsqaure suggests below and do this:

$ ajaxSetup({缓存:假})。

$.ajaxSetup({cache:false})

这篇关于jQuery的AJAX不工作的IE 7/8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆