javascript 访问 webservice

xml:

<?xml version="1.0" encoding="UTF-8"?>
<boolean xmlns="http://tempuri.org/">false</boolean>

 

javascript:

$.ajax({
    url: "../webService/CommonExternalWebService.asmx/CheckSystemVersionIsBicp",
    dataType: "xml",
    success: function (xml) {
        alert($(xml).find("boolean").text());
    },
    error: function (ex) {
        alert("error:" + ex);
    }
});

 带参数的访问:

        $.ajax({
            url: "../webService/CommonExternalWebService.asmx/GetAuthorizationCode",
            data: { loginName: "190001", token: "86ED633B08A1EE6EA9BF241B93A0EADC" }, //参数
            dataType: "xml",
            success: function (xml) {
                alert($(xml).find("boolean").text());
            },
            error: function (ex) {
                alert("error:" + ex);
            }
        });

 

posted on 2019-12-10 18:17  空明流光  阅读(319)  评论(0编辑  收藏  举报

导航