chris keenan:
I'm trying to display Json data on the page, however when sending the Output to html it only displays the last id.
When using console.log
it loops through each id available but not on the page output itself
var username = $("#usernameinfo").text();
$.ajax({
type: "GET",
dataType: 'json',
url: "= base_url()?>"+"account/listings/more_user_ads",
data: {
"username": username,
"pid": "=$this->input->get('pid')?>"
},
success: function(res){
for (var i = 0; i var output = "";
var object = res[i];
output = "" + object.id + "
";
$("#tg-authoradsslider").html(output);
// outputs only the id of 3 which is the last id in the loop
console.log(output);
/* consoles.logs1
2
3
*/
}
}
});
Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots