Ajax data数据格式

来源:互联网 发布:苹果手机数据恢复软件免费版 编辑:程序博客网 时间:2024/05/22 08:10

1.当传递的值为int&string类型时:

function GetDepartment(s) {//获取部门名称

                var ajaxDepartment = $.ajax({
                    type: "Post",
                    data: "{\"BillNO\": '" + s + "'}",
                    url: "../AAA/BBB.ashx?Method=GetDepartment",
                    dataType: "json",
                    success: SetDepartment,
                    error: errorFunction
                });

            }

2.当传递的值为int类型时:

$.ajax({
                type: "post",
                url: "../CCC/DDDashx?Method=DelEEE",
                dataType: "json",
                data: "{ID:" + ID + "}",
                error: function (res) {
                },
                success: function (result) {
                }
            });