1

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?

I'm using the latest version of Chrome and FF 5.

Thanks in advance, Gearoid.

Gerard
  • 4,818
  • 5
  • 51
  • 80

1 Answers1

1

See $.ajax with DELETE loses parameters.

Community
  • 1
  • 1
Femi
  • 64,273
  • 8
  • 118
  • 148