jeudi 30 juillet 2015

Ajax Serialize passing two different check box

i created a 2 tables with checkboxes each row those 2 tables uses 2 different checkboxes how can i pass it to another page using ajax?

<td><span class="wrapper1"><input type="checkbox" name="sendmeso[]" id="cbUnreg" value="<?php echo $row["id"] ?>"/></span></td>

<td><span class="wrapper2"><input type="checkbox" name="sendmesa[]" id="cbReg" value="<?php echo $row["id"] ?>"/></span></td>

those are the properties of the checkboxes this is my ajax can you please check if am i doing it right?

var formData = $( "input[name^=sendmeso]:checked" ).serialize() + $( "input[name^=sendmesa]:checked" ).serialize() + "&imgurl="+ $("#festival").val() + "&message=" + $("textarea").val();    
    $.ajax({
        type: "POST",
        data: formData, 
        url: "processmessage.php", 
        success:function(res){
            $(".greetblock").slideUp(1000);
            $(".serverresponse").prepend(res).hide().fadeIn(2000);
        }
    });

please help me thanks




Aucun commentaire:

Enregistrer un commentaire