Last active
October 18, 2022 09:05
-
-
Save henideepak/c0eaece2e2dcfe2f6d7fa66a15989c2e to your computer and use it in GitHub Desktop.
Ajax Response syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax() jquery function | |
Jquery ajax method takes following arguments: | |
a url to make a call | |
a method name | |
a response type | |
form data to send | |
Following is full syntax used for ajax method: | |
$.ajax({ | |
url: "http://www.phpcodebooster.com/sample/url", | |
method: "POST|GET|PUT|DELETE", // The HTTP method to use for the request | |
dataType: "xml|json|script|html", // The type of data that you're exerciseecting back | |
data: { // Data to be sent to the server. | |
key1: value1, | |
key2: value2 | |
}, | |
error: function() { | |
// A function to be called if the request fails. | |
}, | |
beforeSend: function() { | |
// A function to be called if before the request is made. | |
}, | |
success: function(response) { | |
// A function to be called if the request succeeds. | |
}, | |
complete: function(response) { | |
// A function to be called when the request finishes | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment