Hi guys.
Admitting that I'm not familiar with client-side coding..
I'm trying to get this ajax call working, but I can't figure it out..
function ShowAlert()
{
$.ajax(
{
type: "POST",
url: "DownladData.aspx/Alert",
data: "{}",
contentType: "application/json; charset=utf-8",
datatype: "json",
statusCode: {
404: function ()
{
alert('Method not found!');
}
},
success: function (msg) {
alert('Everything is ok!');
},
error: function (msg) {
alert('Error!!!')
}
});
}
While this is the C# code
[WebMethod]
public static void Alert()
{
}
And this is the button through which I make the ajax call
<input type="button" runat="server" önclick="ShowAlert();" value="Alert" />
This routine doesn't do anithing, but I'd except an alert with the Everything is ok message, instead of an Error!!!.
Using chrome debugger, I get this message:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/AdminPages/DownloadData.aspx/Alert
where Alert() is the WebMethod in the DownloadData.aspx.cs file.
Any suggestion?
Thank you very much!