GET
:$.get(..)
POST
:$.post()..
What about PUT/DELETE
?
GET
:$.get(..)
POST
:$.post()..
What about PUT/DELETE
?
You could use the ajax method:
$.ajax({
url: '/script.cgi',
type: 'DELETE',
success: function(result) {
// Do something with the result
}
});
$.ajax
will work.
$.ajax({
url: 'script.php',
type: 'PUT',
success: function( response ) {
}
});
Seems to be possible with JQuery's ajax function by specifying
type: "put"
or
type: "delete"
and is not not supported by all browsers, but most of them.
Check out this question for more info on compatibility:
Are the PUT, DELETE, HEAD, etc methods available in most web browsers?
You should be able to use jQuery.ajax
:
Load a remote page using an HTTP request.
And you can specify which method should be used, with the type
option :
The type of request to make ("
POST
" or "GET
"), default is "GET
".
Note: Other HTTP request methods, such asPUT
andDELETE
, can also be used here, but they are not supported by all browsers.