jQuery Get/Post

get() and post().

jQuery - AJAX get() and post() Methods

The jQuery get() and post() methods are used to request data from the server with an HTTP GET or POST request.

HTTP Request: GET vs. POST

Two commonly used methods for a request-response between a client and server are: GET and POST.

  • GET - Requests data from a specified resource
  • POST - Submits data to be processed to a specified resource

jQuery $.get() Method

$.get(URL, callback);

jQuery $.post() Method

$.post(URL, data, callback);

Example

$.get("demo_test.php", function(data, status){
  alert("Data: " + data + "\nStatus: " + status);
});