Thursday, February 4, 2010
Re: [jQuery] Menu content within text file
try to use an associative array to build the menu
php:
get data from a yaml file or txt or whatever.
then build the array structure and encode to json. Also could make the file directly in json format
$menu array("link1" => "http://xxxx", "link2" => array ( "link2.1" => "http:/....", "link2.2" => "http://.." ) )
echo json_encode($menu);
jquery:
var mymenu;
$.ajax({
async: false,
success: function(data) { mymenu = data; (render the menu) },
url: "http://urltomenufile.php",
type: "get",
dataType: "json"
});
Thats all
--
Carlos De Oliveira
Departamento De Sistemas
Consultor Senior
0426 517 73 01
0212 204 69 60
cdeoliveira@grupozoom.com
cardeol@gmail.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment