I am trying to do ajax delete with jquery but getting http error 400. I was searching and I've seen that there is some problems with delete method in jquery.
Here's my js, controller(spring 3) and request from Chrome.
If you now what is the mistake please tell, or give some links.
$.ajax({
url: 'additions/cancelUpload',
type: 'DELETE',
data: {filename : ui.draggable.get(0).file.name},
success: function (res) {
alert(res);
}
});
execution does not passed here:
@RequestMapping(value = "cancelUpload", produces="text/html")
@ResponseBody
public String cancelUpload(@RequestParam("filename")String filename, HttpSession session ){
...
}
request:
Request URL:http://localhost:8080/WebStore/additions/cancelUpload Request Method:DELETE Status Code:400 Bad Request Request Headersview source Accept:*/* Accept-Charset:windows-1251,utf-8;q=0.7,*;q=0.3 Accept-Encoding:gzip,deflate,sdch Accept-Language:uk-UA,uk;q=0.8,ru;q=0.6,en-US;q=0.4,en;q=0.2 Connection:keep-alive Content-Length:17 Content-Type:application/x-www-form-urlencoded Cookie:JSESSIONID=A7DF5CB262C460961BC7B5C7DCB23052 Host:localhost:8080 Origin:http://localhost:8080 Referer:http://localhost:8080/WebStore/items?form User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1 1X-Requested-With:XMLHttpRequest Form Dataview URL encoded filename:6648.jpg
Response Headers
Connection:close Content-Length:1043 Content-Type:text/html;charset=utf-8 Date:Sat, 26 May 2012 10:03:58 GMT Server:Apache-Coyote/1.1 X-TraceId:4fc0a8f8-46 X-TraceUrl:/insight/services/traces/4fc0a8f8-46?type=json