Hi all, I have a web service that has a simple web method that takes two parameters of type interger and it returns the result of adding the two numbers together. I made sure to uncomment the following line in my code behind:
[System.Web.Script.Services.ScriptService()]
I am trying to call this webservice from a regular html file using jquery ajax using the following code:
$.ajax({ type: "POST", url: "../MyService.asmx/AddNumbers", data: "{'a':" + $('#txtData1').val()+ 'b': + $('#txtData2').val()+ "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (response, status){ //alert(response.d); $('#output').empty(); $('#output').append(response.d);}, failure: function (){ alert("Failed!"); } });
When I try to call the webservice from my html file I get the "Failed!" alert message. I don't know what else I have to include aside from what I aready have.
Please help me resolve this problem, thanks in advance.