I'm searching for some ready-made solution for working with nested sets with PHP and jQuery.
I know about nested sets and I know how to work with PHP and jQuery but I want to save my time using ready-made solution.
What is the best solution?
a solution to handle nested sets (or any other data structure) would be json_encode/json_decode
Send data from PHP to JavaScript:
$data = new PHPComplexData();
echo json_encode($data);
Receive data in client side:
$.get('data.php', function(data){
var jsData = eval('('+data+')');
//You have a JavaScript object
});
Send data from JavaScript to PHP
var jsData = new JSComplexData();
$.post('data.php', {data:$.toJSON(jsData)});
Receive data in server side
$data = json_decode($_POST['data']);
you need jquery-json plugin to use $.toJSON function