Salve a tutti.
Devo fare in modo che i file presenti sul mio database vengano stampati all'interno di una lista utilizzando jquery. Al momento riesco a stamparli uno dietro l'altro e non capisco come potrei fare.
In PHP
echo
'
<div id="default">
</div>
';
}
$todolist = array();
while ($row = mysql_fetch_array($result))
{
$ID = $row['ID'];
$note = $row['note'];
$riga = array('ID' => $ID, 'note' => $note);
array_push($todolist, $riga);
}
$response = array('todolist' => $todolist);
echo json_encode($response);
in JAVASCRIPT
var html = '<ul>';
for (var n in json) { // Each top-level entry
html += '[*]' + n + '<ul>';
for (var i = 0; i < json[n].length; i++) { // Each sub-entry
html += '[*]' + json[n][i] + '';
}
html += '[/list]';
}
html += '[/list]';
$('body').append(html);
Grazie!!

Rispondi quotando