jQuery的.load()不插入在IE8及以下数据 [英] jquery .load() not inserting data in ie8 and below

查看:385
本文介绍了jQuery的.load()不插入在IE8及以下数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一个解决方案了一整天,但我还是看到了这个错误。

I've been looking for a solution all day, but I'm still seeing this error.

这是一个防爆pression引擎设置为我们的客户,我们要实现AJAX导航。为此,我们使用的是默认的$ .load()函数,这完全在IE9,FF,Safari浏览器,Chrome浏览器,歌剧...但它不能在IE8的工作,并在下面。

It's a Expression Engine setup for a client of ours and we want to implement ajax-navigation. For this we are using the default $.load() function and this works perfectly in ie9, FF, Safari, Chrome, Opera... but it doesn't work in ie8 and below.

我测试过的回调函数,一个是被称为,数据发送,登录时它,我可以阅读在控制台中。但对于一些奇怪的原因,数据未插入。

I've tested the callback function, that one IS being called, the data is send, I can read it in the console when logging it. But for some odd reason the data isn't inserted.

下面是code:

load_page: function(url, func){
    $('#content').load(url+' #content>div', function(data, textStatus, jqXHR){
        console.log('page loaded!');
    });
}   

有一大堆额外的code回调函数,但我已经清理出了整个的JavaScript / CSS的一切。在寻找漏洞,但没有被发现。

There was a whole bunch of extra code in the callback function but I've been cleaning out the whole javascript/css everything. In search of bugs but nothing to be found.

根据我决定加入的网址,并下载了评论:

  • The site this problem is found in: http://www.track.be/devo_9836/nl/ee.php
  • A packet of files, with the problem: http://stijnd.be/ie8_load.zip

另一块拼图: 有一些奇怪的JavaScript的事情。即使是谷歌地图API不正常,这是第一次使用谷歌地图API时这发生在我身上。

Another piece of the puzzle: There is something weird going on in the javascript. Even the google maps api doesn't function properly, that's the first time this happened to me when using the google maps api.

编辑:回答

我终于找到了这个问题的答案,这要​​归功于@epascarello。事实上,它是我试图导入数据的故障。由于IE8和放大器;下面不明白HTML5,他们会尽量的元素导入到DOM,但提醒数据,当我看到以下内容:[对象HTMLUnknownElement],[对象HTMLUnknownElement],[对象HTMLUnknownElement] ...

I finally found the answer to this question, thanks to @epascarello. It is in fact the fault of the data I was trying to import. Because IE8 & below don't understand HTML5 they will try to import the elements into the dom, but when alerting the data I saw the following: [object HTMLUnknownElement], [object HTMLUnknownElement], [object HTMLUnknownElement],...

当我改变了数据的标记用好老div的,而不是物品的元素,一切都很好!

When I changed the markup of the data to use good old div's instead of article-elements, everything worked fine!

推荐答案

我有同样的问题,我注意到,如果该URL返回无效的HTML(如额外的结束标记),它可以加载停止或找到正确的元素

I had the same problem and I noticed that if the url returns invalid HTML (eg. extra end tag) it can stop it from loading or finding the correct element.

在我的例子中我不得不这样做是正确的URL的HTML,然后它工作正常。

In my example all I had to do was correct the HTML from the URL and then it worked correctly.

这篇关于jQuery的.load()不插入在IE8及以下数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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