jQuery .html()在ie8上不起作用 [英] jquery .html() does not work on ie8

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

问题描述

我有一个jquery函数,可对Web服务器上的Webservice方法进行Ajax调用,该方法返回一个包含数据的html表.我正在使用.html()在div上呈现返回值.这可以在Firefox,Chrome,Safari中使用,但不能在IE8上使用

I have a jquery function which makes an ajax call to a webservice method on the web server, the method returns a html table with data. I am using .html() to render the return values on div. This works in Firefox,Chrome, Safari but does not work on IE8

$.ajax({
    type: "POST",
    url: "./../WebAjaxCalls.asmx/GetProductInstruction",
    data: "{'ProductID':'" + $("#txtProductID").val()  + "'}",
    success: function(data) {
        if (data.d[0] == "true") {
            **$("#dvProudctInstruction").html(data.d[1]);** 
        }
    },
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    error: function(e, textStatus, errorThrown) {
        bReturn = false;
    }
});  

$(#dvProudctInstruction").html(data.d [1]); 行适用于除IE8之外的所有浏览器.

The line $("#dvProudctInstruction").html(data.d[1]); works on all browsers except IE8.

在此方面的任何帮助将不胜感激.

Any help on this will be much appreciated.

推荐答案

您可以在将响应分配给html()

You could alert your response before assigning it html()

OR

您可以使用innerHTML属性代替jquery的html()(尽管相同)

You could use innerHTML property instead html() of jquery (though it's same)

您可能要检查链接

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

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