I have an ajax form where I have defined some ajaxOptions
variable and pass that to Ajax.BeginForm
:
var ajaxOptions = new AjaxOptions
{
HttpMethod = "POST",
LoadingElementId = "loading",
OnBegin = "Base.loadingButton('#RegisterSubmit');",
OnSuccess = "Register.onSuccess",
OnFailure = "Base.onError"
};
All JavaScript functions are defined in a special namespace such as Base
, Register
,... .
Now when form submit and in server a error with Code: "0" and Type: "Sql" occurs and logged with elmah, and Status Code: "HTTP/1.1 302 Found" returned from server.
Question 1:
OnSuccess
function fired always even at this case which status 302 returned (but OnSuccess only must fire when status code is 200!!!),why?
Question 2:
sometimes OnSuccess
function never fire even status code is 200!!!,why?