简体   繁体   English

jQuery 1.4.2 ajax不适用于Internet Explorer 8

[英]jquery 1.4.2 ajax does not work with Internet Explorer 8

Greetings, 问候,

I switch to jquery 1.4 but I got this error on ajax call: 我切换到jQuery 1.4,但在ajax调用中遇到此错误:

Message: This method cannot be called until the send method has been called. 消息:在调用send方法之前,无法调用此方法。

Edit: $('#AlertBar').load('/Desktop/Alerts'); 编辑:$('#AlertBar')。load('/ Desktop / Alerts');

After about 9 days of study and search, I have found the solution. 经过大约9天的研究和搜索,我找到了解决方案。

Paste the following code on your xhtml page and try: 将以下代码粘贴到xhtml页面上,然后尝试:

jQuery.ajaxSetup( {xhr:function(){
        //return new window.XMLHttpRequest();
        try{
            if(window.ActiveXObject)
                return new window.ActiveXObject("Microsoft.XMLHTTP");
        } catch(e){}
        return new window.XMLHttpRequest();
        }  
     });

Well, as I am using JSF, it worked nicely!! 好吧,因为我使用的是JSF,所以效果很好!

Good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM