i made jquery function 1 deletes row selected. know option exist in datatables option, want myself, because prefer not use ajax, jquery , json. problem appears when search specify row in datatable search option, click button delete, , nothing happens. other mistake when click next page, then, rows page not work either.
do guys know be?
here let jquery function:
$(document).ready(function() { $( ".botfactura" ).click(function(e) { alert("jkn"); idfact = this.id; var confirmacio = confirm("segur que vol esborrar la factura "+idfact); /*if(confirmacio){ $.post("operacions/borrafact.php", {idfact: idfact}, null, "json").done(function(data){ alert(data.missatge); }) }*/ });});
then, have json file there:
<?php include("../connexio.php"); $idfact= $_post['idfact']; $arraydatos = array(); if($idfact!=""){ $borrar = 'delete factures id="'.$idfact.'"'; //$connborr = mysqli_query($conn,$borrar); $arraydatos['missatge'] = "factura ".$idfact." esborrada!"; }else{ $arraydatos['missatge'] = "no s'ha trobat"; } echo json_encode($arraydatos); ?>
i call $(".botfactura") there:
<button type="button" name="<?php echo $line2['id']?>" id="<?php echo line2['id']?>" class="btn btn-danger botfactura"> <span class="glyphicon glyphicon-trash"></span> </button> <button type="button" name="<?php echo $line2['id']?>" id="<?php echo $line2['id']?>" class="btn btn-success botfactura"> <span class="glyphicon glyphicon-pencil"></span> </button>
finally, i'll upload graphical example what's problem: :the first one, when page works correctly
then,the first issue appears when: i change page of table. can see, click , nothing happens
the same issue appears when try search specific row search box.
well, appreciate if explain why not working! thank you!
i don't know version of jquery using if jquery 1.9 or upper version try
$( document ).on('click', '.botfactura', function(e)
or if using lower version try
$( ".botfactura" ).live('click', function(e)
Comments
Post a Comment