1.

Can you explain the difference between jQuery.get() and jQuery.ajax()?

Answer»


  • jQuery.ajax() allows the creation of highly-customized AJAX requests, with options for how long to wait for a response, what to do once the request is successful, how to handle a failure scenarios, whether the request to be sent is blocking (synchronous) or non-blocking (asynchronous), what format to expect as the response, and many more customizable options.


  • jQuery.get() is uses jQuery.ajax() underneath to create an AJAX request typically meant for simple retrieval of information.
    • There are various other pre-built AJAX requests given by jQuery such as:


      • jQuery.post() for performing post requests


      • jQuery.getScript() meant for loading and then executing a JavaScript file from the server using GET request.


      • jQuery.getJSON() for loading JSON-encoded data from the server using a GET HTTP request.







Discussion

No Comment Found