I am having a problem that I cannot figure out.
I am using the tableDND jQuery add in, which allows me to drag and drop rows of a table. I want to send those rows to the server and have them uploaded to a mySQL database.
My code is below, basically when I get to the PHP the first element of the batting variable is gone. Any ideas?
So I have the following javascript:
$('#order').tableDnD({
onDrop: function(table, row) {
var batting = $.tableDnD.serialize();
var id = <?php echo $id;?>;
$.ajax({
type: 'POST',
url: 'update_batting.php',
data: '{ "batting":' + batting + ', "id":'+ id +' }',
dataType: 'json',
});
}
});
and the following php:
<?php
$batting = json_encode($_POST['order']);
$query = "INSERT INTO test (t) VALUES ('$batting')";
mysql_query($query);
?>