Answer the question
In order to leave comments, you need to log in
What is the correct way to output data using js.each()?
There is a view for output.
<div class="container">
<div class="title-h3 black text-center title-article"></div>
<p class="content-article" style="color: #000"></p>
</div>
$.each(data, function(index, ajaxArticlesObj){
$('.title-article').append(ajaxArticlesObj.title);
$('.content-article').append(ajaxArticlesObj.text);
});
Answer the question
In order to leave comments, you need to log in
<div class="articlemain">
<div class="title-h3 black text-center"></div>
<p class="content-article" style="color: #000"></p>
</div>
$.each(data, function(index, ajaxArticlesObj){
$('.articlemain').append('<div class="title-h3 black text-center">'+ajaxArticlesObj.title+'</div>');
$('.articlemain').append('<p class="content-article" style="color: #000">'+ajaxArticlesObj.text+'</p>');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question