AJAX 几种请求模式对比

//**省略部分代码**//
var modelString = {
                "ID": id,
                "CompensationMethod": CompensationMethod,
                "Subtotal1": Subtotal1,
                "Subtotal1Chinese": Subtotal1Chinese,
                "MoveFee": MoveFee,
                "LossFee": LossFee,
                "LossPrice": LossPrice,
                "FastSignAward": FastSignAward,
                "FastMoveAward": FastMoveAward,
                "Subtotal2": Subtotal2,
                "Subtotal2Chinese": Subtotal2Chinese,
                "HouseArea": HouseArea,
                "HouseResettlementPrice": HouseResettlementPrice
            };
        }
        var modelStringJson = JSON.stringify(modelString);
        var url = '../../API?q=ZSGYTD_HouseInfo.Update&modelString=' + modelStringJson;
        $.ajax({
            url: url,
            //type: 'post',           //get模式只能在url的?后加参数
            //dataType: 'json',
            //data: { modelString: JSON.stringify(modelString) },
            //timeout: 50000,
            async: false,
            success: function (ret) {
                result = ret;
            },
            error: function (e) {
                result = 0;
                console.log('保存写入失败' + e);
            }
        });
        var retObj = {
            "formId": formId,
            "result":result
        }
        return retObj;

//**省略部分代码**//
斩后知
原文地址:https://www.cnblogs.com/dyhao/p/10077714.html