ajax可以发delete,关于jquery:如何在ajax DELETE请求中传递除标头之外的数据

以下是我对DELETE请求的Ajax请求:

deleteRequest: function (url, Id, bolDeleteReq, callback, errorCallback) {

$.ajax({

url: urlCall,

type: 'DELETE',

headers: {"Id": Id,"bolDeleteReq" : bolDeleteReq},

success: callback || $.noop,

error: errorCallback || $.noop

});

}

除了headers之外,还有其他传递数据的方法吗?

阅读此错误问题:http://bugs.jquery.com/ticket/11586

引用RFC 2616字段

The DELETE method requests that the origin server delete the resource identified by the Request-URI.

因此,您需要在URI中传递数据

$.ajax({

url: urlCall + '?' + $.param({"Id": Id,"bolDeleteReq" : bolDeleteReq}),

type: 'DELETE',

success: callback || $.noop,

error: errorCallback || $.noop

});

因此,您可以在jquery 1.7.2之前使用DELETE发送数

你可能感兴趣的:(ajax可以发delete)