making multiple ajax/jsonp requests doesnt seems to work!
I am using the following code to make multiple requests
- var a1 = makeRequest(config.servers[0]);
- var a2 = makeRequest(config.servers[0]);
- var all=[a1,a2];
-
- $.when(all).done(function(results) {
- console.log(results);
- });
- function makeRequest(server) {
- return $.ajax({
- url: buildUrl(server),
- type: "GET",
- dataType: 'jsonp',
- jsonpCallback: "datasource "
- });
- }
Intermittently I am getting the following error! Why?
- Uncaught TypeError: datasource is not a function