我想提出一个简单的jQuery AJAX调用,但使用DELETE方法,而不是GET或POST。该方法被质疑,但这些参数不似乎传递了 - 我可以看到这个当我检查请求的URL中的萤火虫。下面就是code是这样的:
I'm trying to submit a simple jQuery ajax call but using the DELETE method instead of GET or POST. The method is queried but the parameters don't seem to be passed up - I can see this when I inspect the request URL in firebug. Here's what the code looks like:
$.ajax({
type:"DELETE",
url:"/api/deleteGame",
dataType:"json",
data: "gameId=" + gameId + "&userId=" + userId,
success:function(json)
{
if(json != null && json.errors == undefined) {
alert("Game successfully deleted");
parent.closeDialog();
parent.refreshCaller();
} else {
showServerErrors(json.errors);
}
},
error:function(xhr, textstatus, errorThrown)
{
alert("An error occured! " + errorThrown + ", " + textstatus)
}
});
这是否看行不行?它是正确的追加参数,像你这样的删除请求字符串将一个得到什么呢?
Does this look okay? Is it correct to append the parameters to the DELETE request string like you would a GET?
我使用的是Chrome和FF 5,最新版本的
I'm using the latest version of Chrome and FF 5.
在此先感谢, Gearoid。
Thanks in advance, Gearoid.
请参阅 $就与删除丢失参数。