How to call a webservice method from an html page [javascript] with out refresh the page

后端 未结 2 1554
不知归路
不知归路 2021-02-02 01:01

I have a webservice which will return a value. Here my requirement is, I need to call that webservice from an index.html page, that page h

2条回答
  •  伪装坚强ぢ
    2021-02-02 02:07

    You can send ajax request to a webservice

     $.ajax({
                url: "WebServiceURL",
                data: "", //ur data to be sent to server
                contentType: "application/json; charset=utf-8", 
                type: "GET",
                success: function (data) {
                   alert(data);
                },
                error: function (x, y, z) {
                   alert(x.responseText +"  " +x.status);
                }
            });
    

提交回复
热议问题