0

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?

Carlos
  • 57
  • 2
  • 9

1 Answers1

0

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.

Community
  • 1
  • 1
brainimus
  • 9,668
  • 11
  • 40
  • 63
  • That part worked fine on FireFox. On IE, something keeps the whole function from working. Even something as simple as alert("This is a test") inside the function isn't being called on IE6. – Carlos Jul 13 '10 at 20:18
  • Just confirmed that setting the correct content type doesn't work. The only thing like it I saw before was when my javascript had an error and FF would tell me the function I was trying to call didn't exists. – Carlos Jul 13 '10 at 20:28