MooTools Problem in IE with Request

Posted by trobrock on Stack Overflow See other posts from Stack Overflow or by trobrock
Published on 2010-05-27T00:09:52Z Indexed on 2010/05/27 0:11 UTC
Read the original article Hit count: 198

I have this class method in a mootools class:

getData : function(){
  var r = new Request.JSON({
    url : this.container.getAttribute('data-url'), 
    method : 'post', 
    onSuccess : function(j){
      this.cards = j;
      this.prepareQuiz();
    }.bind(this)
  }).send();
},

In any browser aside from IE this works fine, but in IE I get a this.cards is not defined in a method that occurs after the this.prepareQuiz method does it's stuff. I narrowed the problem to this section by adding an if ($defined(this.cards)) before the this.prepareQuiz call and if I just keep refreshing the page 1 out of every 5 or so times it will work. So the this.cards variable is not being set some of the time for some reason.

Why would this happen?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about AJAX