mercredi 16 mars 2016

function executed twice after checkbox checked

I use the below code

$("#cc1").unbind('click').click(function(e) {
    //somefunction
});

in order to execute a function after cc1 button is clicked. With this code everything works great.

When I use the below code

$("#pay").unbind('click').click(function(e) {

    if($('#cc').is(':checked')){
        //somefunction
    }
});

in order to execute the same function as above but when cc checkbox is checked and button pay is clicked the function is executed more than once and I receive errors in db reading...

What is the problem?

when pay button is clicked the app passes some vars to a function in order to update - import data into a db. If cc is checked the app passes different data.




Aucun commentaire:

Enregistrer un commentaire