OK, allora di seguito il codice che carico dal body:

//GLOBAL VAR DECLARATION
var xhr=null; //Manage data
var user;

function load_tree(username){

user=username;

//check input fields
if (user=='')
{
return false;
}
else {

if (window.XMLHttpRequest)
{// code for Firefox, Opera, IE7, etc.
xhr =new XMLHttpRequest();
}
else if(window.ActiveXObject)
{// code for IE7, IE6, IE5
xhr =new ActiveXObject("Microsoft.XMLHTTP");
}

if (xhr!=null)
{

try {

var parameters="Menu.php?user="+user;

xhr.onreadystatechange=Tree;

xhr.open("GET",parameters,true);

xhr.send(null);

} catch(err){ alert(err); }

}else { alert("Your browser does not support XMLHTTP."); }

}

}


function Tree(){

if (xhr.readyState==4) // 4 = "loaded"
{
if (xhr.status==200) // 200 = OK
{
var htmlCreate="";

htmlCreate+="<Table id='table_menu' align='left' width='200' height='100' cellpadding='0' cellspacing='0' border='2' background='/tool_web/img/box.gif' bordercolor='white' rules='none' > ";

var menu=document.getElementById('left_menu');

var json_data=xhr.responseText;

var tree=eval('('+json_data+')');

var cont=0;

for(i=0;i<tree.length;i++){

htmlCreate+="<tr> <td width='10%'></td> <td width='30%' height='10' align='left'>
<span style='CURSOR: pointer; font-weight: bold;' onclick=\"return content('"+tree[i]["NAME"]+"','"+user+"');\" /> [img]"+tree[i]["LINK_IMM"]+ "[/img] <td width='50%' height='10' align='left'>
<span style='CURSOR: pointer; font-weight: bold;' onclick=\"return content('"+tree[i]["NAME"]+"','"+user+"');\" /> "+tree[i]["NAME"]+"</span></td></tr>";

}

htmlCreate+="<tr> <td>
</td> </tr></Table>";

menu.innerHTML=htmlCreate;

return true;

}
else
{
alert("Problem retrieving data"+xhr.statusText);
return false;
}
}else { document.getElementById('left_menu').innerHTML="Lo ading Left Menù.."; }

}



E di seguito quello che carico dall'onClick:

//GLOBAL VAR DECLARATION
var request=null; //Manage xml or json


//LOAD TREE - BEGIN
function cerca(user){

if (window.XMLHttpRequest)
{// code for Firefox, Opera, IE7, etc.
request =new XMLHttpRequest();
}
else if(window.ActiveXObject)
{// code for IE6, IE5
request =new ActiveXObject("Microsoft.XMLHTTP");
}

if (request!=null)
{

try {

var parameters="ProfileSub.php?user="+user+"&campo="+c ampo+"&valore="+valore;

request.onreadystatechange=QueryProfile;

//posso anche mettere a posto del php il file json o xml che sia
request.open("GET",parameters,true);

request.send(null);

} catch(err){ alert(err); }

}
else
{
alert("Your browser does not support XMLHTTP.");
}
return true;
}



//LOAD TREE - END
function QueryProfile(){

//try {

if (request.readyState==4) // 4 = "loaded"
{ alert("cazzo");
if (request.status==200) // 200 = OK
{
var htmlCreate="";
menu=document.getElementById('result_span');

htmlCreate+="<tr> <td width='10%'></td> <td width='30%' height='10' align='left'> [img]/tool_web/img/menu.gif[/img]</td> <td width='50%' height='10' align='left'>

</td> </tr>";

var result=document.getElementById('result_span');

var json_data=xhr2.responseText;

var tree=eval('('+json_data+')');
alert(tree);
var cont=0;

for(i=0;i<tree.length;i++){

htmlCreate+="<tr> <td width='10%'></td> <td width='30%' height='10' align='left'>
<span style='CURSOR: pointer; font-weight: bold;' onclick=\"return content('"+tree[i]["IMSI"]+"','"+user+"');\" /> [img]"+tree[i]["IMSI"]+ "[/img] <td width='50%' height='10' align='left'>
<span style='CURSOR: pointer; font-weight: bold;' onclick=\"return content('"+tree[i]["IMSI"]+"','"+user+"');\" /> "+tree[i]["HEADER1"]+"</span></td></tr>";

}

htmlCreate+="<tr> <td> "+tree[1]["HEADER1"]+"cazzo
</td> </tr>";

menu.innerHTML=htmlCreate;

return true;

}
else
{
alert("Problem retrieving data -"+request.status+"-"+request.statusText);
}
}
// } catch(err){ alert(err); }
}



Il PHP:

<html>
<head>
<title>Home - BSS Profiling</title>

<link rel="stylesheet" href="css/tree.css"/>
<link rel="stylesheet" href="css/scrollbar.css"/>
<link rel="stylesheet" href="css/error.css"/>
<link rel="stylesheet" href="css/normal.css"/>
<link rel="stylesheet" href="css/table.css"/>

<script language="JavaScript" src="js/menu.js"></script>
<script language="JavaScript" src="js/query.js"></script>
<script language="JavaScript" src="js/profile.js"></script>

</head>
<body bgcolor="#d2effc" onLoad="load_tree('<?php echo $username ?>');">

........

<input type="submit" onClick="cerca('<?php echo $username ?>');" name="ricerca" value="Cerca" style="BACKGROUND-COLOR: #0066CC; font-family: Monotype Corsiva;font-size: 14pt; COLOR: white">