jQuery的html的()在IE 11功能不工作 [英] jQuery .html() function doesnt work in IE 11

查看:111
本文介绍了jQuery的html的()在IE 11功能不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的.NET MVC3 Web应用程序我有一个Ajax调用返回一些HTML code。我通过这个网站变成一个div像这样:

In my .net MVC3 web application i have an ajax call that returns some html code. I pass this html into a div like so:

    $.ajax({
            url: 'controller/action',
            data: {id: id,},
            type: 'GET',
            async: false,
            success: function (data) {
                $("#container").html(data);

            },
        });

这正常工作在所有浏览器除了IE以外11.什么情况是,HTML犯规在#container的格渲染,除非我的地方点击页面上。

This works fine in all browsers except ie 11. What happens is that the html doesnt render in #container div unless i click somewhere on the page.

我怎样才能获得HTML渲染没有点击任何地方IE11?

How can i get the html to render without clicking anywhere in ie11?

感谢

推荐答案

这样做的一个可能的原因是,有在由AJAX的IE是不满意返回的HTML一些小块的语法。脚本> 标记在我的情况下,它通过一个具有&LT内部HTML注释引起的。 IE摔倒了,但其他浏览器都很好。

A likely cause for this is that there is some small piece of syntax in the HTML that is returned by ajax that IE is not happy with. In my case it was caused by having an HTML comment inside a <script> tag. IE fell over but other browsers were fine.

我建议删除一切从Ajax调用返回除了一条线,如TEST的HTML。如果这样的作品,那么你知道这是不是一个jQuery / JavaScript的问题。然后,您可以添加回进线返回的HTML,直到你发现IE是不愉快就行了。

I suggest removing everything from the HTML returned by the ajax call except one line such as 'TEST'. If that works then you know it isn't a JQuery / Javascript issue. You can then add back lines into the returned HTML until you find the line that IE isn't happy with.

这篇关于jQuery的html的()在IE 11功能不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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