[jQuery] halt script running

[jQuery] halt script running


i got this code
and i want that if :
result.status == 0 - show the error div (its works)
if its 1 then redirect to another page
if its 2 (critical / unknown error) - stop exectue of this script and return
alert
right now its keep runing if i got status 2
ideas how to solve it?
<script type="text/javascript">
$(function() {

$().ajaxSuccess(function(request, settings){
alert('Done!');
});

$().ajaxStart(function() {



$.blockUI( '<h1>
http://crazilla.linuxlab/images/icons/loading/loading1.gif <BR> Just a
moment...</h1>' );

}).ajaxStop(function() {

$.unblockUI();
});

$().ajaxError(function(a, b, e) {
throw e;
});

$.validator.setDefaults({
debug: false
});


var v = $("#MyForm1").validate({




/////// begin rules //////////////////////////////////////////

rules: {

MyForm1nicknameInputfield: { maxLength: 45
}}

/////////// end rules ///////////////////

,

focusInvalid: "false",

event: "keyup",

submitHandler: function(form) {

$(form).ajaxSubmit({

dataType: "json",

after: function(result) {

if(result.status == 0) {


v.showErrors(result.data);

} else

if(result.status == 2) {
alert(result.data);
}
else
if(result.status == 1) {
}


}
});
}
});
});

</script>
--
View this message in context: http://www.nabble.com/halt-script-running-tf3428418.html#a9556286
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/






























































































    • Topic Participants

    • amir