1

I am a .net developer willing to learn mobile web technology. currently i am working on Android platform. I found Jquery to be suitable framework for me as i am from web background. Till now i am able to create a simple web application on android but, i am not able to make AJAX calls from Jquery to my .net webservice. I want to create a test enviornment for my android web app.

1. I have ASP.NET web service running on my local computer 

    namespace JqueryMobile
    {
        [System.Web.Script.Services.ScriptService]
        public class WebService1 : System.Web.Services.WebService
        {

            [WebMethod]
            public string HelloWorld()
            {
                return "Hello World";
            }
        }
    }
my webservice URL is : http://localhost:26415/WebService1.asmx

2. My android index.html 

     $(function(){
                $.ajax({url:"localhost:26415/WebService1.asmx/HelloWorld",
                success:function(result){
                           alert(result);
                           }});
     });
    This technique fails in local environment so, how do i test it?
Alex Naspo
  • 2,052
  • 1
  • 20
  • 37
Ulhas Tuscano
  • 5,502
  • 14
  • 58
  • 89

1 Answers1

2

make these changes:

1.uncomment [System.Web.Script.Services.ScriptService] as an attribute to your Web Method

2.Also change your url to like http://localhost:1096/MySite/WebService.asmx/HelloWorld?callback

3.try using IP address instead of loaclhost http://IPADDRESS:1096/MySite/WebService.asmx/HelloWorld?callback

see this post:What is the best way to call a .net webservice using jquery?

Community
  • 1
  • 1
ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213