fbemo Posted November 23, 2009 Share Posted November 23, 2009 Hello, Below is my script; $(document).ready(function(){ $('form input').hover(function(){ $(this).addClass('input_hover'); }, function(){ $(this).removeClass('input_hover'); }); $('form input').focus(function(){ if($(this).val() == 'http://') $(this).val(''); }); $('button').click(function(){ if($('form input[@type="text"]').val() == '') return false; $(this).attr('disabled', true); $('#link').hide(); $('#processing').show(); $.post("ajax.php", { 'a' : 'make_short', 'url' : $('form input[@name="url"]').val(), 'tag' : $('form input[@name="tag"]').val(), 'ip' : $('form input[@type="hidden"]').val() }, function(data){ if(data == 'invalid'){ $('#processing').hide(); $('button').attr('disabled', false); alert('Invalid Url'); return false; } if(data.search(/^error/) != -1) { var datap = data.split('::'); if(datap[1] == '0001') { $('#processing').hide(); $('button').attr('disabled', false); alert('Custom Tag may contain letters, numbers and dashes'); return false; } if(datap[1].search(/^0002/) != -1) { alert('Chosen Custom Tag is already in use. aaa'); <!-- I Want the Script STOP here or jump to any function that will Stop the whole SCRIPT without executing the code below $('#processing').hide();........... --> } } $('#processing').hide(); $('#link span').html('<a href="' + data + '" target="_blank">' + data + '</a>' ).parent().show(); $('button').attr('disabled', false); return false; }); return false; }); }); You can found this inside the code: <!-- I Want the Script STOP here or jump to any function that will Stop the whole SCRIPT without executing the code below $('#processing').hide();........... --> I want to stop the whole script if if(datap[1].search(/^0002/) != -1) without executing the next whole lines... (Means nothing will be happening, nothing will be executed). Thanks a lot Quote Link to comment Share on other sites More sharing options...
mraza Posted November 23, 2009 Share Posted November 23, 2009 sorry i never read all of your code but if the conditions met you can use exit; at the end of your lines to exit that point, if not work wait for somebody else... Cheers Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted November 23, 2009 Share Posted November 23, 2009 this isn't PHP, its javascript. but window.stop will stop the rendering and execution of the current page. Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted November 23, 2009 Share Posted November 23, 2009 exit; Quote Link to comment Share on other sites More sharing options...
fbemo Posted November 24, 2009 Author Share Posted November 24, 2009 Ooppss.. sorry, actually this is .js not .php... exit; not working by the way anything else? maybe call function created at top to halt all program? Quote Link to comment Share on other sites More sharing options...
salathe Posted November 24, 2009 Share Posted November 24, 2009 Maybe I'm missing something obvious but couldn't you just return at that point? Quote Link to comment Share on other sites More sharing options...
fbemo Posted November 24, 2009 Author Share Posted November 24, 2009 Maybe I'm missing something obvious but couldn't you just return at that point? Sorry, I don't get it... Btw, if you look into that coding... there is a function(data);.. I want to create another function similar to that but won't passing these codes (see below) when it reads this statement if(datap[1].search(/^0002/) != -1) $('#processing').hide(); $('#link span').html('<a href="' + data + '" target="_blank">' + data + '</a>' ).parent().show(); $('button').attr('disabled', false); return false; }); return false; }); }); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.