I was wondering whether I should use asynchronous calls on my website or not. I know to specify this explicitly I need to use
$.ajax
however initially I tried using $.get and although the server had to return lots of information, my browser didn’t stuck and I could navigate without any problems.
I searched a little bit online about it, however I’m still not 100% certain about the difference between the two.
If $.get is asynchronous then what’s the point of $.ajax? And if it’s not, then again seeing how I had no navigation problems with $.get, what’s the point of using $.ajax?
thanks in advance
Yes,
$.getis asynchronous. From the documentation:…and as that doesn’t have the
asyncoption,asyncdefaults totrue. (Note thatasyncwill be going away entirely in a future version of jQuery; it will always be true.)$.ajaxgives you control over lot more options.$.getis just a shortcut.