I have found this information on the web about jquery ajax requests.
load(): Load a piece of html into a container DOM.
$.getJSON(): Load a JSON with GET method.
$.getScript(): Load a JavaScript.
$.get(): Use this if you want to make a GET call and play extensively with the response.
$.post(): Use this if you want to make a POST call and don’t want to load the response to some container DOM.
$.ajax(): Use this if you need to do something when XHR fails, or you need to specify ajax options (e.g. cache: true) on the fly.
But it doesn’t say anything about performance which is best for using it for what. Which is best for from validation? Which is best in speed and such alike.
I have never used jQuery ajax before and wondered from some of you more experienced programmers in your time of using jQuery ajax requests which have your find suit your needs best?
What is JSON I know it is called javascript object notation but what does mean?
Like kingjiv said, each and every one of those go through the
$.ajaxmethod.load()sets the type to get/post does other things in the background to make sure that the response is populated on the selected element then calls$.ajax. Below is the code.$.getJSON(): This just calls
$.getsetting thedataTypetojson.$.getin turn calls$.ajax$.getScript(): You guessed it, just calls
$.getand passes in thedataTypeasscript.$.get() & $.post(): These two methods call $.ajax as well.
In conclusion, use whatever is suited to the purpose, just depends on what you intend to do. The performance should be the same since you have seen they all go through
$.ajax