问题描述:

I have the following code working perfeclty in FireFox, but it won't work at all on IE6:

$("[name=servicos\\[\\]]").each( function() {

this.checked = false;

alert(this.name);

}

);

$.getJSON("check_servicos.php?id=" + id,

function(data) {

$.each(data,

function(key, val) {

alert($("#" + key).attr("id"));

if(val > 0) $("#" + key).attr("checked", "checked");

}

)

}

);

Could anyone tell me what I'm missing, other than a way to forcefully upgrade all browsers at my job?

网友答案:

Check that check_servicos.php is setting the correct content-type for JSON (correct content-type is discussed here: What is the correct JSON content type?).

I had a similar problem when trying to read XML and setting the content-type to "text/xml" solved my issue. I found the solution to my problem here: jQuery .find() doesn't return data in IE but does in Firefox and Chrome.

相关阅读:
Top