is it possible to use an onclick event command on a text link to call a php script which deletes a specific row from a mysql db table?
here is what i have so far.
my text link code
Code:
<a class="deleteRow" onclick="
$.ajax({
type: 'post',
url: "http://www.{WEBSITEDOMAIN}.co.uk/delete.php",
data: {joodb field|id},
});
;" href="#">Delete</a>
and my php file
PHP Code:
<?php
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
$id = (int) $_POST['id'];
// make sql query to remove element with given id
echo '<script type="text/javascript">window.alert("$id")</script>';
}?>
at the moment the php file just displays an alert box, just to confirm the script is being called and the correct id value is being passed.
unfortunately when i press on the text link nothing happens, or so it appears! if i open firebug and then click on the console tab it gives the following error
Code:
SyntaxError: syntax error
https://s-static.ak.facebook.com/connect/xd_arbiter.php?version=18
Line 13
which is odd as there is no facebook on this page??? and the error only comes up when i click on the text link.
can anyone help me with this please?
many thanks
Luke