The following code is a very simple ajax call to server that alerts back on success and complete events.
From a reason I cannot understand on my development machine it works fine and alerts on success and complete but on server it never alerts on success. WHY ???
**
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
function dummy() {
$.ajax({
url: 'services/chatEngine.asmx/dummy',
async: true,
type: "POST",
complete: function () { alert('Done'); },
success: function (a, b, c) {
alert('Success');
}
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</ajaxToolkit:ToolkitScriptManager>
<div id="userList">Users:<br /></div>
<input id="Button3" type="button" value="dummy" onclick="dummy()" />
</div>
</form>
</body>
</html>
**
The server side dummy function returns nothing, code follows –
<WebMethod(True)>
Public Function dummy() As String
Return ""
End Function
You need to find out where the failure is.
1) Is the client making the request? Use your browsers developer tool request monitor or something like Charles to look at the request data. make sure the URL is correct.
2) Is the server getting the request? Use server logs or attach a debugger to verify the request is received.