Ajax call does not return proper result as string

前端 未结 1 423
再見小時候
再見小時候 2021-01-26 04:04

My ajax call. I am not getting the desired response as string. Can anyone help me in this regard. Thanks in advance.

function Function1() {
    alert(\"In Ajax C         


        
1条回答
  •  清歌不尽
    2021-01-26 04:14

    Your code is working fine in my machine.May be you forgot to call it by document load in Jquery. My code

        
          
    

    and my code behind file

            [WebMethod]
            public static string MyFunction1(string parameter)
            {
                //try
                //{
                //    if (true)
                //    {
                //        return "test";
                //    }
                //}
                //catch (Exception ex)
                //{
                //    return ex.Message;
                //}
                return parameter;
            }
    

    0 讨论(0)
提交回复
热议问题