Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

javascript
html

What are Ajax methods?

Sarvech Qadir

Ajax( Asynchronous JavaScript And XML) is used to create asynchronous web applications. It is deployed on the client-side and makes use of several web technologies. Ajax has made it easier to asynchronously send and retrieve data from a server without interfering with the existing page’s display and functionality.

Ajax is not a programming language, and it requires a built-in browser with the XMLHttpRequest object, which requests data from the server.

Ajax also uses JavaScript and HTML DOM to display the data.

JQuery Ajax methods

The jQuery library has a full suite of Ajax capabilities. These methods allow a user to load data from the server without refreshing the browser. The following is a list of such Ajax capabilities:

  1. .ajaxComplete(): Registers a handler to be called when the Ajax requests are complete. This is an AjaxEvent.

  2. .ajaxError(): Registers a handler to be called when the Ajax requests complete with an error. This is an Ajax Event.

  3. .ajaxSend(): Attaches a function to be executed before an Ajax request is sent. This is an Ajax Event.

  4. .ajaxStart(): Registers a handler to be called when the first Ajax request begins. This is an Ajax Event.

  5. .ajaxStop(): Registers a handler to be called when all Ajax requests have been completed. This is an Ajax Event.

  6. .ajaxSuccess(): Attaches the function to be executed whenever an Ajax request completes successfully. This is an Ajax Event.

  7. jQuery.ajax(): Performs an asynchronous HTTP (Ajax) request.

  8. jQuery.ajaxPrefilter(): Handles custom Ajax options or modify existing options before each request is sent and processed by $.ajax().

  9. jQuery.ajaxSetup(): Sets default values for future Ajax requests.

Its use is not recommended.

  1. jQuery.ajaxTransport(): Creates an object that handles the actual transmission of Ajax data.

  2. jQuery.get(): Loads data from the server using an HTTP GET request.

  3. jQuery.getJSON(): Loads JSON-encoded data from the server using a GET HTTP request.

  4. jQuery.getScript(): Loads a JavaScript file from the server using a GET HTTP request, then execute it.

  5. jQuery.param(): Creates a serialized representation of an array, a plain object, or a jQuery object suitable for use in a URL query string or Ajax request. In case a jQuery object is passed, it should contain input elements with name/value properties.

  6. jQuery.post(): Sends data to the server using an HTTP POST request.

  7. .load(): Loads data from the server and places the returned HTML into the matched elements.

  8. .serialize(): Encodes a set of form elements as a string for submission.

  9. .serializeArray(): Encodes a set of form elements as an array of names and values.

RELATED TAGS

javascript
html

CONTRIBUTOR

Sarvech Qadir
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring