ASP.NET 500 Internal Server Error while calling webmethod from javascript

前端 未结 5 2099
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-02 17:53

I\'m trying to call the webmethod fucntionality using AJAX but unable to get the appropriate results. I have googled my problem and found many solution but thos

5条回答
  •  北荒
    北荒 (楼主)
    2021-01-02 18:35

    Probably you need to add static to your method declaration as below

    [WebMethod]
    [ScriptMethod(UseHttpGet = true)]
    public static string getUsername(string value)
    {
       return "True";
    }
    

    if this isn't the case, you could F12 the browser->network then click on the error message to see it briefly.

    Concerning the reported issue,the problem with get request, try to make it post

提交回复
热议问题