Tuesday, 15 May 2012

javascript - Deletinq record from database using ajax -



javascript - Deletinq record from database using ajax -

i have problem deleting records database, using ajax , jquery. if click button nil happens. there css:

<button class='delete_p' id_p='<?php echo $post_id; ?>'>x</button>" <script type="text/javascript" src="jquery-1.11.1.js"></script> <script src="delete_post.js"></script>

and there ajax i'm using:

$(document).ready(function(){ $('.delete_p').click(function(){ var del_id = $(this).attr('id_p'); $.ajax({ type:'post', url:'delete_post.php', data:'delete_id='+del_id, }); }); });

and there delete_post.php i'm using:

<?php include 'esas/core/database/connect.php'; $id = $_post['delete_id']; $query = "delete `status` `id` = '$id'"; ?>

data shouldn't string javascript object:

$.ajax({ type: 'post', url: 'delete_post.php', data: { delete_id: del_id } });

javascript php jquery html

No comments:

Post a Comment