I am working on a web application and I need to upload several $ .ajax files. I found something interesting in $ .when (). Then ().
It works fine when I have nothing special about the data returned by the request, like this example:
$.when( $.getScript('js/script1.js'), $.getScript('js/script2.js') ).then(function(){
If it works well when I have one ajax request, for example:
$.when( $.ajax('xml/myxml.xml') ).then(function(data){
But if I try the following, I cannot get it to work:
$.when( $.ajax('xml/myxml.xml'), $.getScript('js/script.js') ).then(function(data){
I read the pending object page, but most of it was too technical for me, and I cannot figure out how I should be able to get my ajax when I use $ .when (). then () to load scripts and data from multiple sources.
So, if someone can help me find out how to use my ajax data in my test case above, that would be great! And if in the meantime someone can explain the pending object object in a way that is easier to understand than the official jQuery documentation, that would be awesome!
Thanks!
Gabriel
source share