Hello readers, today i guide you "jQuery loop in JSON result from AJAX Success".
If you are working with JSON and and want to display all JSON value in AJAX Success, you can do this using jquery loop.
Recently I am working on a project and I want to append 5 post at a time so I use "jQuery loop in JSON result from AJAX Success. Below is the code you can use copy my code and modify according to your need.
$.ajax({
url: site_url+"/ajax-quectiondata.php",
data: myData,
dataType: 'json',
success: function(responseData) {
$.each(responseData, function(i, item) {
//alert(item.post_title);
var pre_post = $('.post-'+setData).children('p.subheading').last().text();
if(item.post_title != pre_post){
$('#cat-'+setData).before( "<p class='subheading'>"+item.post_title+"</p>");
$('#cat-'+setData).before( "<p class='text'>"+item.post_content+"</p>");
}
});
}
});
Thankyou, I hope it help you.
0 Comment(s)