SQL delete statement and Javascript?
I have the following HTML:
<input type="button" onclick=askPermissionToDelete() name="deleteCust" value="Delete">
On the same form, I have some php code that displays records with a radio button beside it. When I have a radio button selected, and press the Delete button, I want to delete that record. So how can I call my javascript function, ask the user permission to delete, and than delete the record and refresh the page. Please help!!!
Never done AJAX before…is there any sample code I could go by?
Another thing you can do is confirm() without the AJAX. Get to know the basics before you start getting into things like AJAX, which might require a rewrite of some of your existing code. Follow the link in the source to see an example of what you can do.
June 30th, 2009 at 2:48 am
Ask the user's permission first, in Javascript. Then use AJAX to send the information - the identification of the record to delete - to the php page that will do the deletion. If the php page sends back a confirmation, you can display "record deleted", or whatever you want using Javascript - no need to refresh the page at any time.
References :
June 30th, 2009 at 3:10 am
Another thing you can do is confirm() without the AJAX. Get to know the basics before you start getting into things like AJAX, which might require a rewrite of some of your existing code. Follow the link in the source to see an example of what you can do.
References :
http://www.tizag.com/javascriptT/javascriptconfirm.php