jquery ajax调用不在函数调用上

时间:2017-11-02 07:17:05

标签: c# jquery ajax api web

function GetSelectedTextValue() { 
    var selMenu = document.getElementById("selMenu"); 
    var selMenuValue = selMenu.value; 
    var selOptions=document.getElementById("selOptions"); 
    var selOptionsValue = selOptions.value; 
    var UserInput=$("#txtClaimNumber").val(); 
    if(selMenuValue=="Claims_Related" && selOptionsValue=="1") { 
        Claim_related_api(UserInput); 
    } 
}

function Claim_related_api( Claim_number) {
    var model = { PolicyNumber: "236426891", ClaimNumber: Claim_number };

    $.ajax({
        type: "Post",
        data: JSON.stringify(model),                
        url: 'http://asplb-dev-00433/api/ClaimDetailsByClaim',
        dataType : "json",
        contentType: "application/json"

    }).done(function (res) {               
        alert(res[0].CLAIM_ID);

    });
}

1 个答案:

答案 0 :(得分:0)

你可以像这样使用

function Claim_related_api( Claim_number) {
    var model = { PolicyNumber: "236426891", ClaimNumber: Claim_number };



    $.ajax({
        type: "Post",
        data: JSON.stringify(model),                
        url: 'http://asplb-dev-00433/api/ClaimDetailsByClaim',
        dataType : "json",
        contentType: "application/json",
        success: function (response) {
            console.log(response);

        },
        error: function () {
            console.log(error);
        },
    });

}