0

i have a web page on server on http://techcodesolutions.com/test/urlHostDemo/callHost.aspx address. In that page i have [webMethod] that is

[WebMethod]
public static string method()
{
    return "This is message from server";
}

i want to call this method through my local web page using ajax with code

$(document).ready(function () {
        $("#aClick").click(function () {
            $.ajax({
                type: "POST",
                url: "http://techcodesolutions.com/test/urlHostDemo/callHost.aspx/method",
                contentType: "application/json;charset=utf-8",
                dataType: "json",
                success: function (data) {
                    var b = data.d;
                    $("#lblMessage").text(b);
                },                    
                error: function (response) {
                    alert("no match");
                }
            });
        });
    });

but it is show ajax error message. Could you guys please tell my how to call it.

0 Answers0