Return false after prompt but continue with script
Hi all,
I have a click function which firstly opens a prompt dialog, calls an ajax script and then proceeds to the second part of the function.
By adding a
return false; after the prompt the script it unable to proceed to step 2.
Does anybody have a better way of doing what Im trying to do?
- $("#btn_next").click( function(event){
- var form_values = $('#content_form [name^="data"]').serialize();
- var url = $(this).attr('href');
- var action = $('#content_form').attr('action');
- // Step 1
- if( $('body').hasClass('template-informationform') ){
- bootbox.confirm("Do you need to blah blah?", "No", "Yes", function(result) {
- var skip = false;
- if (! result){
- skip = true;
- }
- $.post('/content/ajaxskipcontent', {data: skip});
- });
- return false;
- }
- // Step 2
- if (form_values.length > 0) {
- $.post(action, {data: form_values}, function(result) {
- if (result=='success') {
- window.location.href = url;
- }else{
- alert('Unable to save content');
- }
- });
- return false;
- }
- });