ajax call success function never called

Posted by Shai on Stack Overflow See other posts from Stack Overflow or by Shai
Published on 2012-04-02T11:26:30Z Indexed on 2012/04/02 11:28 UTC
Read the original article Hit count: 215

Filed under:

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 fins 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 -

Public Function dummy() As String Return "" End Function

© Stack Overflow or respective owner