如何通过在AJAX数据删除请求,比头其他 [英] How to pass data in the ajax DELETE request other than headers

查看:532
本文介绍了如何通过在AJAX数据删除请求,比头其他的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的Ajax请求的删除要求:

Below is my Ajax request for a DELETE request:

deleteRequest: function (url, Id, bolDeleteReq, callback, errorCallback) {
    $.ajax({
        url: urlCall,
        type: 'DELETE',
        headers: {"Id": Id, "bolDeleteReq" : bolDeleteReq},
        success: callback || $.noop,
        error: errorCallback || $.noop
    });
}

有没有通过比其他数据任何其他方式标题

推荐答案

阅读这个Bug问题: HTTP://bugs.jquery。 COM /票/ 11586

Read this Bug Issue: http://bugs.jquery.com/ticket/11586

引述 2616菲尔丁

删除方法请求原始服务器删除该资源的由Request-URI

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

所以,你需要传递的数据在URI

So you need to pass the data in the URI

$.ajax({
    url: urlCall + '?' + $.param({"Id": Id, "bolDeleteReq" : bolDeleteReq}),
    type: 'DELETE',
    success: callback || $.noop,
    error: errorCallback || $.noop
});

这篇关于如何通过在AJAX数据删除请求,比头其他的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆