1

Hi friends I am using http://www.wookmark.com/jquery-plugin

   $.post('get_category',data={type:'All'},function(data)
             {

              $.each(data,function(item,i){

             var image_path = "<?php echo base_url();?>assets/images/"+i.image_name;

             var str = '<li data-filter-class="["'+i.category_name+'"]"><img src="'+image_path+'" height="283" width="200"><p>London Art</p></li>';


  $("#tiles").prepend('<li data-filter-class=["'+i.category_name+'"]><img src="'+image_path+'" height="283" width="200"><p>London Art</p></li>'); 

                                     }); },'json'

            );

I am using ajax to write the html content into the div in document.ready() function but nothing is being displayed. I checked console.log and I am getting correct callback data from the ajax call.Please help me to fix this one

This is my complete JS http://codepen.io/anon/pen/vdigl

Hacker Rocker
  • 251
  • 2
  • 4
  • 13

1 Answers1

0

Try using var array = JSON.parse(data);

$(array).each(function(i,val){
    $.each(val,function(k,v){
          //your code     
});
});

Modify it to do your work.

Vinh
  • 73
  • 6