I'm working on a JS delete function right now that deletes a row from an SQL table and it just doesn't quite work, heres the function:
$(document).ready(function(){
$( "#draggable" ).draggable();
$( "#droppable" ).droppable({
drop: function(e, ui) {
var id = $(this).data('ID');
var ajaxurl = 'delete.php';
$.post(ajaxurl,{rowid:id});
alert("You have deleted the row successfully");
$(ui.draggable).remove();}
});
});
I've checked this for syntax errors and its clean, the function in delete.php also works, so i'm stuck as to what the problem might be, any help would be greatly appreciated,
Try to send id variable with get method:
var id = $(this).data('ID');
var ajaxurl = 'delete.php?id='+id;
And get id variable in delete php :`
$id=$_GET['id'];
Regards.