简体   繁体   English

ajax调用后,jQuery无法在IE中运行

[英]jquery not working in IE after ajax call

I am using organictabs plugin, which I initiate in every page load in this form: 我正在使用Organictabs插件,该插件会以这种形式在每次页面加载时启动:

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

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

The tabs work fine in all browsers, and then I perform an ajax call which regenerates the tabs with the following code: 该选项卡在所有浏览器中均能正常工作,然后执行ajax调用,该调用将使用以下代码重新生成选项卡:

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

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

  });
}

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. 同样,选项卡会重新生成,并且在我尝试切换选项卡时,除IE中的IE浏览器外,其他所有浏览器都可以正常工作。 I am initiating the jquery code onreadystate change, and i really can't figure out what can the problem be with IE? 我正在初始化onreadystate更改的jQuery代码,但我真的不知道IE可能出现什么问题?

Any help will be greatly appreciated. 任何帮助将不胜感激。

All the best 祝一切顺利

The problem was with how IE handles the ("a.sample_class").attr("href") attribute. 问题在于IE如何处理(“ a.sample_class”)。attr(“ href”)属性。 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. 在Chrome / FF中,返回相对路径(在这种情况下,仅返回锚点#tag),而在IE中,在我调用ajax页面后,将返回绝对路径(http://www.mysite.com/#标签),因此尝试在当前页面中找到整个锚(字符串)。

More information regarding this issue you can read in this article: http://www.glennjones.net/2006/02/getattribute-href-bug/ 您可以在本文中阅读有关此问题的更多信息: 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 希望这对某人有帮助,因为这确实花了我几天的时间

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

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