Saturday 15 May 2010

javascript - Keeping the information obtained in a $.ajax call's done(...) method -


I'm getting the right stuff in done , but with a broad scope for a variable Assignment does not work This worked for example $ Everyone (...) So I made a mistake, that he will work here too.

  var outee = null; $ Ajax ({url: "http: // ...", datatype: 'jesnpi', ...}). (Function) {// display displays well (stuff); // works well (but possibly a global outfree target) outre = accessories; display (outre);}); // Displaying NADA, NICK, ZILCH etc. due to outreach (outreach); How do I get the  done  method for  done  to be used in  done  method to use the range of anonymous functions?  

Am I right to assume that the assignment refers to inside done global outee ? One way of solving my problem will not be to hide the var -ed outsee by global outee by declaration, right? But is this a bad programming style for me?

Yes, you are right that you are specifying your for global variable. , there is nothing wrong in that, the problem is that you are trying to use that global variable before the completion of your AJAX call ( i.e. your .one Is executed ).

This is because of asynchronous behavior or AJAX, it is an bad method of working on it that your AJAX call synchronous to async: false

No comments:

Post a Comment