I have created a WebService directory in my MVC web application’s root folder and created a webservice named MyService.asmx. In this file, I created an method UpdateReadCount, which I call from javascript with below code.
function updateReadCount(contentID) {
$.ajax({
type: "POST",
url: "/WebServices/MyService.asmx/UpdateReadCount",
data: "{'contentID': '" + contentID + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (json) {
//$("#" + messageView).html(json.d);
}
});
}
I am getting Page Not Found error. This is happening at hosted page, while it works perfectly on localhost.
Why use a .asmx with an MVC application? You can just do a clean controller action for this.