Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple Phonegap application to call simple web service
    text
    copied!<p>I am a beginner in Phonegap and I made a simple web service in Microsoft Visual studio 2010 with two simple method. I want to call a method from that service from my Phonegap application for android platform. I am using xui library which method xhr is pretty much incomprehensible for me. I have read a lot of posts in that topic but I could not figure out how to do that. </p> <p>My link to the web service looks like this: <code>http://localhost/testservice/Service1.asmx</code>.</p> <p>This is my web service code:</p> <pre><code>[System.Web.Script.Services.ScriptService] public class Service1 : System.Web.Services.WebService { [WebMethod] public string HelloWorld() { return "Hello World"; } [WebMethod] public int Calculate(int firsNumber, int secundNumber) { return firsNumber + secundNumber; } } </code></pre> <p>This is my method which should test that service:</p> <pre><code>function checkWebService() { var url = new "http://localhost/testservice/Service1.asmx?op=HelloWorld"; x$('#test').xhr(url, {error: function(){alert("failed "+this.responseText)}, callback: function(){ alert("Success " + this.responseText); } }); </code></pre> <p>I call this method on button click and I am always getting alert with the text "Success", without "response text".</p> <p>Probably my url is wrong, but I do not know which url I suppose to type. This is for "HelloWorld" method without parameters, and I also do not know how to call method with parameters.</p> <p>Any help or explanation please.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload