简体   繁体   中英

Json Response NULL from webservice

hi im Using Web service in IPhone i am Getting Json Response null when i use loacal server to Run im getting Response this is my Code

 [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

this is my link to call webservice

http://tagcheckin.com/Webservice/Webservice1.asmx

To call a WebService from AJAX, you need to decorate the service with the [ScriptService] attribute

If you want to access you service using GET :

  • Add the [ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)] attribute to the web method

     [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)] public string HelloWorld() 
  • Add the following configuration to your web.config right under <system.web> (server config where the web service lives).

     <webServices> <protocols> <add name="HttpGet" /> <add name="HttpPost" /> </protocols> </webServices> 

As a reminder, when using XML services you need to access the returned object as:

success: function (m) {
    $res.append("Message: " + m.d);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM