Myservice.asmx.cs
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.Toolbox
[System.Web.Script.Services.Sc
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
[WebInvoke(Method = "POST", UriTemplate = "")]
public stringGetName()
{
return "Hello I am from service ";
}
}
<script type="text/javascript">
function Btngetservice_onclick() {
alert("select");
$.ajax({
alert :"ajax",
type : "POST",
url: http://localhost:35999/
data:"{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
try {
var theRealData = msg.d;
alert(theRealData);
results.innerHTML = theRealData;
results.innerHTML = "theRealData";
}
catch (e) {
alert(e);
}
}
})
}
</script>
<body>
<h1>Hello Cordova</h1>
<p>
<br />
<input id="Btngetservice"onclick="return Btngetservice_onclick()"
type="button"value="GetService"/><br />
<br />
</p>
<br />
</body>
when i was running my application it showing only
alert("select");
but it not enter into the
$.ajax({
//my code here please see the above index.html
});
Actually i don't know why it's not hit the service url... ?
[NOte :Here my intention is service return the some text i.e ".Hello I am from service "
when i click on button the event should call to the my service. but here didn't called.]
please let me know the where i did mistake?
[here i didn't used C# , mainpage.xaml and mainpage.xaml.cs]
i was tested webservice working fine,no issues in webservice.
Thanks in advance,
NareshrajuU