Created
October 27, 2015 00:53
-
-
Save balanza/06fbdbf6c1a67d529319 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //array of async resources to be loaded | |
| var paths = ['file1.xml', 'file2.xml', 'file3.xml']; | |
| //the callback for the ajax call | |
| var callback = function(fileIndex){ | |
| alert('this is a callback for file ' + paths[fileIndex]); | |
| }; | |
| //generates ajax calls | |
| for(var i=0; i<=paths.length; i++){ | |
| ajax.get('http://foo.com/' + paths[i], _.partial(callback, i)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment