jQuery的AJAX调用后没有工作在IE工作、jQuery、AJAX、IE

2023-09-10 21:10:35 作者:乜许、珴沒資格

我使用organictabs插件,我开始在每个页面加载以这种形式:

I am using organictabs plugin, which I initiate in every page load in this form:

    $(function() {
        $("#example-one").organicTabs();

        $("#example-two").organicTabs({
            "speed": 200
        });    
    });

该标签很好地工作在所有浏览器,然后我进行Ajax调用它再生的选项卡具有以下code:

The tabs work fine in all browsers, and then I perform an ajax call which regenerates the tabs with the following code:

if(xmlHttp.readyState == 4)
{
  HandleResponse(xmlHttp.responseText,'page-wrap');

  $(function() {
        $("#example-two").organicTabs({
            "speed": 200                
        });                   

  });
}

再次标签正确再生,一切工作正常,在所有浏览器IE除外,当我尝试切换标签页这是行不通的。我开始jQuery的code onreadystate的变化,我实在想不出有什么问题可以与IE浏览器?

Again, the tabs are regenerated properly and everything works fine in all browsers EXCEPT in IE, when I try to switch tabs it doesn't work. I am initiating the jquery code onreadystate change, and i really can't figure out what can the problem be with IE?

任何帮助将大大AP preciated。

Any help will be greatly appreciated.

所有最优秀的

推荐答案

但问题是与IE浏览器如何处理(a.sample_class)。ATTR(HREF)属性。在镀铬/ FF的相对路径返回(在这种情况下,仅仅锚#tag),而在IE中,我在呼唤一个ajax页面后,正在返回的绝对路径(http://www.mysite.com/#标记),因此试图找到在当前页的整个锚(字符串)。

The problem was with how IE handles the ("a.sample_class").attr("href") attribute. In Chrome/FF the relative path is returned(in this case just the anchor #tag), whereas in IE, after I was calling an ajax page, the absolute path was being returned(http://www.mysite.com/#tag), hence trying to find the entire anchor(string) in the current page.

对于这个问题,你可以在这篇文章中读到的更多信息: HTTP:/ /www.glennjones.net/2006/02/getattribute-href-bug/

More information regarding this issue you can read in this article: http://www.glennjones.net/2006/02/getattribute-href-bug/

希望这是有帮助的人,因为它真的把我的时间了几天

Hope this is of help to someone, as it really took a few days of my time