Let\'s say I have the following jQuery AJAX call:
$.ajax({ type: \"POST\", url: \"MyUrl\", data: \"val1=test\", success: function(result){
Return an error code on the server side using the HTTP error the best equates to what the error is. Then use the error callback. This will also allow you to show errors given by your webserver.