在IE8中,JQuery内容消失了

时间:2012-05-30 09:00:25

标签: jquery html

我在IE7 / IE8中遇到了JQuery的问题。下面的“我的代码”位于我的页面顶部,该代码将插入到CMS页面中。然后,将内容(FAQ导航)加载到主页面中的空div中。

<script type="text/javascript" src="/wcsstore/MadisonsStorefrontAssetStore/images/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$.get('/wcsstore/MadisonsStorefrontAssetStore/images/contentspots/viva/faqnavigation.html', function(data) {
 $('#faq_links').html(data);
});
</script>

正如您从上面所看到的那样,内容会被插入到我页面中的空div中,这是页面中的第一个。

<div id="faq_links"></div>

我在FF,Opera,Safari,Chrome和IE9中测试了这一切,一切都很好,问题来自IE7 + IE8。有时候导航会加载(但是选择一个链接会使它再次消失),有时它会留下一个空白区域。它链接到的文件只是一个简单的ul,有大约20个链接。

我尝试在页面中添加一个警报,看看它是否通过添加

来加载JQuery
alert('Load was performed.');

就在})之前;工作,并在每次加载页面时给出“加载”弹出窗口,但仍然没有加载内容。

我无法将您链接到该页面,因为它位于开发CMS中。找出导致我导航消失的原因的任何帮助都会被批评。

如果您需要,我很乐意回答您的任何问题或提供更多信息。

感谢。太

2 个答案:

答案 0 :(得分:1)

尝试添加$(document).ready

<script type="text/javascript">
$(document).ready(function(){
   $.get('/wcsstore/MadisonsStorefrontAssetStore/images/contentspots/viva/faqnavigation.html',   function(data) {
    $('#faq_links').html(data);
   });
})
</script>

答案 1 :(得分:0)

尝试在请求中添加随机数.... 我不知道它会解决问题吗......我希望如此

$(document).ready(function(){
    $.get('/wcsstore/MadisonsStorefrontAssetStore/images/contentspots/viva/faqnavigation.html', { rnd: Math.floor(Math.random()*11) }, function(data) {
    $('#faq_links').html(data);
     });
  });
相关问题