I am trying to use web service using jquery ajax. The webservice method is called and the parameter are passed as well, I wonder why the ajax would not execute success function
Here's my ajax call
<script type="text/javascript">
function btn_add() {
var a = $("#tb_a").val();
var b = $("#tb_b").val();
var c = $("#tb_c").val();
var para = "a=" + a + "&b=" + b + "&c=" + c;
$.ajax({
type: "POST",
url: "mywebservice.asmx/add",
data: para,
dataType: "text",
success: function (res) {
alert("success");
console.log(res);
}
});
}
</script>
Edit
Here is my webservice code
[System.Web.Script.Services.ScriptService]
public class mywebservice : System.Web.Services.WebService
{
[WebMethod, ScriptMethod]
public int add( int a, int b, int c)
{
return a + b + c;
}
}