I'm loading html content using JQuery $.ajax and it gives warning
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
here is my code
var html = $.ajax({
type: "GET",
url: "http://localhost/loginmodal.php",
async: false
}).responseText;
$('#' + divID).append(html).trigger("create");
I found somewhere that this warning can be fixed if I use async: true option. But, when I use async: true option, ajax simply doesn't work. If I use async: false option, it gives the error.
Situation.
- globalFunctions.js has the utility function which calls above code. This function has the only code above, nothing else. It has a parameter divID on which ajax html will be loaded.
- home.php has a button. If user clicks the button, this calls the function in globalFunctions.js.
This is it! The only library I'm using is JQuery.
Thank you for your answer in advanced!