Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
174
rated 0 times [  175] [ 1]  / answers: 1 / hits: 19161  / 9 Years ago, wed, january 6, 2016, 12:00:00

I know this question was posted so many times in here, but I tried all the solutions I could find on stack overflow and none of them worked.
I'm just trying to make a simple ajax query to load a page inside a div.
Just as simple as:



function loadHome(){
$('#container').html('<div class=loader></div>');
$.ajax({
type: GET,
url: home.php,
success: function(msg){
$(#container).html(msg);
}
});
}


And on the console log I get




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/




And some of my javascript on the home page will not work unless I reload the page. That page is by default loading home.php inside the div already, but I want it to load other pages and then when I click home it should load normally, and that's not happening because of that error. I already tried to use async: true, didn't work. I don't know what to do.


More From » jquery

 Answers
20

You should use local jquery then from cdn and also



To avoid this warning, do not use:



async: false


in any of your $.ajax() calls. This is the only feature of XMLHttpRequest that's deprecated.



The default is async: true, so if you never use this option at all, your code should be safe if the feature is ever really removed (it probably won't be -- it may be removed from the standards, but I'll bet browsers will continue to support it for many years).



Referance


[#63826] Monday, January 4, 2016, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
annaw

Total Points: 18
Total Questions: 91
Total Answers: 98

Location: Guam
Member since Fri, Jun 18, 2021
3 Years ago
;