I am using jQuery and JSON to get data from database
$("#openNotification").on('click', function(e)
{
ID = "a";
$.ajax(
{
url: "notificationDetail",
type: "POST",
data:
{
designationID: ID
},
dataType: "JSON",
success: function (jsonStr)
{
$(".processingNotification").hide();
var jSonLength = jsonStr.length;
for (var i=0; i<jSonLength; i++)
{
var userAvatar = jsonStr[0].userAvatar;
var newrow = "<div class='subNotification'><img src='assets/img/avatar/"+userAvatar+"'/></div>";
}
$(".opened_page").html(newrow);
}
});
});
HTML
<div class="opened_page"></div>
When I click #openNotification
I can see the jSon data from PHP
But when I want to display the data to .opened_page
it only show 1 data.