mercredi 15 juillet 2015

Exiting a callback function

I would like to ask how to exit the callback function given below before ajax call if valueid2 equals 0

callback: function() {
                        console.log('save');
                        console.log($('#re_confirm')[0].checked);
                        var valueid = document.getElementById('idtable').value
                        if(valueid == 0)
                           myFunction();
                        var valueid2 = document.getElementById('idtable').value

                         $.ajax({
                            url : "<?php echo base_url(); ?>http://ift.tt/1I1GSdD",
                            type: "post",
                            data: {
                                "table_id" : $('#idtable').val(),
                            },
                            success: function(response){
                                   ...
                            }
                       });
      }

Please tell me how to exit the callback function.




Aucun commentaire:

Enregistrer un commentaire