views:

60

answers:

1

There is some straightforward AJAX code that works in Firefox and Chrome but not in IE. I am not doing anything fancy but the code is too long to post here.

Essentially, it is:

<script type="text/javascript">
var baseurl = 'http://mydomain.com/facebook/';
 var setUpGame = function(lvl){
  var ajaxurl;
  ajaxurl = baseurl+'ajax.php?f=gg&l='+lvl;
  $.getJSON(ajaxurl,function(data){
                   //do stuff with data here
  });
 };
 $(document).ready(function(){
  setUpGame(3);
 });
</script>  

The problem is that IE has a problem with $.getJSON. The call stack shows that it fails in the bowels of jQuery (Line 123, column 183) where the jQuery code reads "return new A.XMLHttpRequest"

The error message is "Error: Object doesn't support this property or method". I have verified that the ajaxurl variable has the right value and that URL returns the correct JSON.

Could this be happening because all this is running inside an iFrame?

A: 

I switched from jQuery 1.4.2 to 1.3.2 and this problem disappeared.

Sid Ahuja
Make sure you mark this as the correct/accepted answer :)
Alastair Pitts
I've created a bug report on dev.jquery.com. I don't want to jump the gun, though. If they investigate and come back with some other reason for the error, I'll post the right answer back here.
Sid Ahuja