得到:$ . GET (. .)
职位:$ . POST () . .
PUT/DELETE呢?
得到:$ . GET (. .)
职位:$ . POST () . .
PUT/DELETE呢?
当前回答
美元。Ajax可以工作。
$.ajax({
url: 'script.php',
type: 'PUT',
success: function(response) {
//...
}
});
其他回答
如果你想赚美元。将工作post到Laravel Route::delete或Route::put只需添加一个参数"_method"="delete"或"_method"="put"。
$.post("your/uri/here", {"arg1":"value1",...,"_method":"delete"}, function(data){}); ...
必须适用于其他框架
注:用Laravel 5.6和jQuery 3测试
阿贾克斯()
寻找参数类型
这里也可以使用其他HTTP请求方法,如PUT和DELETE,但并非所有浏览器都支持它们。
你可以使用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) {
//...
}
});
你可以在你的数据散列中包含一个名为:_method的键,值为'delete'。
例如:
data = { id: 1, _method: 'delete' };
url = '/products'
request = $.post(url, data);
request.done(function(res){
alert('Yupi Yei. Your product has been deleted')
});
这也适用于