Difference between xmlhttprequest and $ .ajax (), $ .load

What is the difference between

xmlhttprequest and $ .ajax ()

I want to know which one is the easiest function to load data ....

+5
source share
3 answers

XMLHttpRequest is a raw ajax request object. Working directly with this would be the “easiest”, but you lose all the cross-browser compatibility provided by the $ .ajax () method in jQuery. If you want your code to work in all browsers, you should use $ .ajax ().

+8
source

$. ajax uses XmlHttpRequest under the hood. See here

, $.ajax, , -

+1

jQuery $.ajaxis just a crossbrowser compatible wrapper around. XMLHttpRequest.You don’t need to enter countless nasty if/ tryto make it work in any web browser that the world wide web knows about. If you use jQuery, you should use it (or one of the Ajax functions ).

+1
source

All Articles