I have created a Webmethod in ASP.NET, and trying to access that through jQuery AJAX. When I call the Webmethod through browser it's giving a JSON result, but when I call that through jQuery AJAX it's giving "204 no content" in Firebug of Firefox. (My webmethod is in one domain and jQuery AJAX code is in other domain).
JQuery Ajax Code:
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "http://localhost:1177/api/authentication/getusermenu?roleid=1",
processData: true,
dataType: "jsonp",
success: function (msg) {
alert(msg.d);
},
error: function (jqXHR, textStatus, errorThrown) {
var data = $.parseJSON(jqXHR.responseText);
alert(data);
}
});
Firebug Output: