得到:$ . GET (. .)

职位:$ . POST () . .

PUT/DELETE呢?


当前回答

你可以使用ajax方法:

$.ajax({
    url: '/script.cgi',
    type: 'DELETE',
    success: function(result) {
        // Do something with the result
    }
});

其他回答

你可以使用ajax方法:

$.ajax({
    url: '/script.cgi',
    type: 'DELETE',
    success: function(result) {
        // Do something with the result
    }
});

美元。Ajax可以工作。

$.ajax({
   url: 'script.php',
   type: 'PUT',
   success: function(response) {
     //...
   }
});

这是一个更新的ajax调用,当你使用JSON与jQuery > 1.9:

$.ajax({
    url: '/v1/object/3.json',
    method: 'DELETE',
    contentType: 'application/json',
    success: function(result) {
        // handle success
    },
    error: function(request,msg,error) {
        // handle failure
    }
});

似乎可以通过JQuery的ajax函数指定

输入:“put”或 类型:“删除”

并不是所有浏览器都支持,而是大多数浏览器都支持。

看看这个问题,了解更多关于兼容性的信息:

PUT, DELETE, HEAD等方法在大多数网络浏览器中可用吗?

阿贾克斯()

寻找参数类型

这里也可以使用其他HTTP请求方法,如PUT和DELETE,但并非所有浏览器都支持它们。