I'm new to JQuery and Web Services. My question is (in the following code), why does url: "WebService1.asmx/WebMethod" work through this JQuery code but if I type that URL directly in my browser, it says the path cannot be found? I have to manually click on the "Invoke" button for the service in the browser in order to call the method and then it navigates to WebService1.asmx/WebMethod.
$(document).ready(function () {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "WebService1.asmx/WebMethod",
data: "{}",
dataType: "json",
success: function (msg) {
alert(msg.d);
},
error: function (errormessage) {
alert("got an error");
}
});
});