javascript - Load specific data from external source -


given script load data specific div of external source on click. load data form div of external source. trying load specific things want. load image, title, post label, date , comments only, not text summery, in same order.

script:

$(function() {     var page = null;     var counter = 0;      function getnext() {     // grab next element array of date-outer divs , copy .content div         if (counter >= page.length)             return;         var elm = $(page[counter]).clone();         elm.find('script').remove(); // remove script tags in div         elm.appendto('#load-here');         counter++;     }      $('button.btn').click(function(e) {         if (page === null) {             page = false; // prevents request being made twice             $.get('http://test-html-site.blogspot.com/search/label/', function(data) {                 page = $(data).find('.date-outer');                 getnext();             });         } else if (page !== false) {             getnext();         }     }); }); 

html:

<button class='btn'/> <div id="load-here"></div> <!-- load here -->  </body> 

html structure of external site:
given script load .date-outer per click.

<body> <div class="blog-posts hfeed">   <div class="date-outer"> contecnt 1: title, img, comments, text </div>  <div class="date-outer"> contecnt 2: title, img, comments, text </div>  <div class="date-outer"> contecnt 3: title, img, comments, text </div>  </div> </body> 

example external site link
single content structure.

my question how load specific data, image, title, post labels, date , comments only, not text summery, in same order.

try snippet selecting particular content external source

$('#destination-image1-id').load('xxx.html #image1'); 

ref : https://stackoverflow.com/a/4101874/2632619


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -