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?
1
  • 2
    Try to make the webservice live on some machine & then assign that ip instead of localhost. Commented Apr 21, 2012 at 5:56

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.