Ho risolto cosi:
codice:
<script type="text/javascript">
var $j=jQuery.noConflict();
function setChat(){
var uid= "<?php echo $user2["uid"]?>";
$j.ajax({
url: "chat/selectUser.php",
type: "POST",
data: "uid=" + uid,
dataType: "json",
success: function(msg) {
var arr_responseall=msg;
$j('#chat').html('');
var $table = $j('<table id="box-table-a">');
//tbody
var $tbody = $table.append('<tbody />').children('tbody');
// add row
for(i=0;i<arr_responseall.length;i++){
var name=arr_responseall[i].name;
var surname=arr_responseall[i].surname;
var id_foto=arr_responseall[i].id_foto;
var uid=arr_responseall[i].uid;
var showedname=name+' '+surname;
$tbody.append('<tr />').children('tr:last')
.append('<td>[img]profileImages/'+id_foto+'.jpg[/img]</td>') .append('<td>'+name+' '+surname+'</td>'); }
// add table to dom
$table.appendTo('#chatuserlist'); },
error: function(){
alert("Chiamata fallita!!!"); } });
return false; };
</script>