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开发者_JAVA百科 = 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?
My guess would be that due to the asynchronous nature of the call, this.cards is not being initialized by the time it needs to be. At least that's what your symptoms indicate. Try a synchronous call and see if you have the same problem.
精彩评论