Delete a div id using ajax and jquery and delete from DB
Posted
by Matt Nathanson
on Stack Overflow
See other posts from Stack Overflow
or by Matt Nathanson
Published on 2010-04-12T22:35:40Z
Indexed on
2010/04/12
22:43 UTC
Read the original article
Hit count: 706
I've got several div id's, each containing a different client. I want to be able to click the delete button and using ajax and jquery delete the specific div from the database. I'm getting success in AJAX but it's not deleting anything from the DB. And then obviously, upon deletion, I would like the container to reload dynamically. help!!!
function DeleteClient(){ var yes = confirm("Whoa there chief! Do you really want to DELETE this client?"); if (yes == 1) { dataToLoad = 'clientID=' + clientID + '&deleteclient=yes', $.ajax({ type: 'post', url: '/clients/controller.php', datatype: 'html', data: dataToLoad, success: function(html) { alert('Client' + clientID + ' should have been deleted from the database.'); $('#clientscontainer').html(html); }, error: function() { alert('error'); }});}; };
© Stack Overflow or respective owner