I try to use for loop inside an AJAX callback, but I can't get it to work.
function swapsite(e){
$.ajax({
type: "POST",
url: "../queryadmin.inc.php",
data: {site:e}
}).done(function( msg ) {
console.log(msg);
var result=JSON.parse(msg);
console.log("----------------");
console.log(result);
$('#draggable').html("<p id='article"+result[0]['id']+"'>"+result[0]['title']+"</p>");
var i=0;
for(i=2,i<=7,i++) $('#draggable'+i).html("<p id='article"+result[i]['id']+"'>"+result[i]['title']+"</p>");
});
}
The problem is with the line starting with for