0

I'm building a web app which handle large amount of data. After user logged in, I'm making several requests to my server, in order to get all needed data. I need those requests to be sync, so I'm can remove my loader from the site after it finishes.

This is what i'm trying to do:

    $.ajaxSetup({async: false});
    myFirstSyncFunction();
    mySecondSyncFunction();
    myThirdSyncFunction();
    $.ajaxSetup({async: true});

This code block returns "No transport" in IE10 for each request. If I remove both lines of "ajaxSetup", everything works good (but in async way). Also, in chrome, FF and Safari it works perfectly (with or without those lines).

Any suggestions?

Asaf
  • 2,158
  • 2
  • 25
  • 40
  • 1
    why don't you use callbacks to make these requests synchronous – Arun P Johny Aug 02 '13 at 08:34
  • @Asaf : What you can do is Call first function and on success call the 2nd function and on its success call 3rd function. On the success of 3rd function hide the loader. – Mahesh KP Aug 02 '13 at 08:42
  • It sounds like you're doing cross-domain requests, but then it also wouldn't work with async. What happens when you add `$.support.cors = true;`? – user247702 Aug 02 '13 at 09:01
  • *" I need those requests to be sync, so I'm can remove my loader from the site after it finishes"* The Ajax calls don't have to be synchronous for that. Just remove the the loader after the responses have been received. *Especially* if you have to load a lot of data, synchronous requests are a *bad* idea. This should help you: [jQuery: Wait till multiple GET requests are successully processed](http://stackoverflow.com/q/9898813/218196) – Felix Kling Aug 02 '13 at 09:02

0 Answers0