Problems with XMLHttpRequest AngularJS

0

I have a $ http.get request in my application as it can be seen at AngularJS ng-repeat does not return data, returns always empty

But I'm getting a Warning in the browser console with the following message:

Synchronous XMLHttpRequest on the main thread is deprecated 
because of its detrimental effects to the end user's experience.

How can I resolve this?

    
asked by anonymous 07.04.2015 / 23:10

1 answer

1

Possible causes:

  • If the return of your request $http.get has a mention to a javascript file, jQuery (as well as other libraries) will attempt to load the file mentioned in synchronous mode (since it assumes that you need the JS file to interpret the content being transmitted.
  • If your request (which in practice translates as an XMLHttpRequest request) is running in the main thread and without the flag indicating an asynchronous operation - for example, $.ajax() with async: false .

Solutions: Make your request in a separate thread , or use the async: true flag in jQuery.

This message is native to the browser. JQuery, for implementing synchronous load, can trigger the warning.

    
08.04.2015 / 06:22