AJAX Page - Debugging for synchronous callback

Make a callback with data synchronously

We will use the same example used for the no error handling example.

Here is the Callback code with error handling done in the try catch blocks, depending on the exception type:

        ob_post.AddParam("Number1", 49583);
        ob_post.AddParam("Number2", 83924);
            alert("The sum is: " + ob_post.post(null, "onSum"));
            switch (ex.type){
                case "InvalidCastException":
                    // the code to execute when one of the arguments is not of the correct type
                    alert ("One of the arguments is not of the correct type.");
                case "ServerMethodNotImplemented":
                    // the server-side method name is not implemented
                    alert ("The server-side method was not found.");
                case "MyException":
                    // an error is thrown by the user at server-side
                    alert ("I threw this exception server-side");
                case "CallbackError":
                    // there was an error server side
                    alert ("There was an error server-side.");
We will use ShowErrorsAtClient=false and ThrowExceptionsAtClient=true so we can show our own alert messages.

Click to test the correct callback:

If the ServerFileName is misspelled:

If the server method is misspelled:

If one of the arguments is not an integer:

If the numbers are equal:

You may also check the debug for asynchronous callback example to see the differences.