Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • jQuery loop in JSON result from AJAX Success

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.71k
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: