-4

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?

Mirgorod
  • 31,413
  • 18
  • 51
  • 63

2 Answers2

2

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

ilyes kooli
  • 11,959
  • 14
  • 50
  • 79
1

Your question is quite hard to understand, but if I'm reading you right, you're looking for some kind of jQuery treeview control?

Maybe something like this: http://www.dynamicdrive.com/dynamicindex1/treeview/index.htm

or this: http://be.twixt.us/jquery/treeViewCollapsed.php

or any number of others....?

Spudley
  • 166,037
  • 39
  • 233
  • 307