I am trying to change my code to use json on recommendation from a previous question to simplify things a bit...
On client side:
<script type="text/javascript" src="../js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../js/jquery.tablednd_0_5.js"></script>
<script type="text/javascript" src="../js/jquery.json-2.2.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#table').tableDnD();
});
function sendData() {
data = $('#table').tableDnDSerialize();
alert(data); // shows expected data
document.dataform.data.value = $.toJson(data);
document.data.submit();
}
</script>
<form action="$php_page_name" method="post" name="dataform" onSubmit="sendData()">
<input type="hidden" name="data" />
<input type="submit" value="Submit" />
</form>
The js alert outputs the expected array, which i think is converted to a string by this point. But when I submit form.data, my php:
$data = json_decode($_POST['data']);
print_r($data);
print_r($_POST);
returns only:
Array ( [data] => )
Any ideas why nothing is being passed ?
Cheers, Andy