0

Well after extensively web searches and several years of failing to understand documentation and finding alternative solutions, I've come to you to ask how I should go about my problem.

Note: Each AJAX request has a unique success function.

One of the suggested similar questions was - How to loop through Ajax Requests inside a JQuery When - Then statment? - is this similar to what I need, albeit the incompatibility with my unique success callbacks?

$.when(

  $.ajax({
    url: '/-.json',
    method: 'get',
    dataType: "jsonp",
    complete: function(r) {

      //my stuff

    }
  }),

  $.ajax({
    url: '/-.json',
    method: 'get',
    dataType: "jsonp",
    complete: function(r) {

      //my stuff

    }
  })

).then(function() {

  console.log('leggo');

});

I based my solution on CSS-Tricks article but console.log is never fired, though the AJAX requests are.

Thanks

Tom Chapman
  • 433
  • 7
  • 15

1 Answers1

0

The answer was the dataType, as @charlietfl suggested. I have no heckin' idea why, but changing from jsonp to json was the answer. They're obviously more different than just the obvious situational usage.

Tom Chapman
  • 433
  • 7
  • 15
  • `jsonp` is a very different type of request that requires a function returned and the request itslef is actually a script request, not an xmlHttpRequest (ajax) – charlietfl Jul 04 '17 at 21:23