Calling WebMethod in aspx.cs returning HTML page

时间:2015-10-06 08:58:41

标签: javascript c# asp.net

I have the following code in my aspx.cs file:

[System.Web.Services.WebMethod]
public static string PostPin() {
    return "Rahul";
}

And the following Javascript:

$.ajax({
type: "POST",
url: "/adfs/ls/RequestPinForm.aspx/PostPin",
contentType: "application/json; charset=utf-8",
success: function(data) {
    alert(data);
},
error : function(data , data2 , data3) {
    alert(data);
}
});

I'm using the alert's to see the returns of what is coming back, but I can never get it to return the string.

Any ideas guys?

0 个答案:

没有答案