jquery - JavaScript <div> .class Extraction -


i writing javascript retrieves webpage site, , displays 'notices' site.
fortunately, 'notices' div elements of class 'event'.
want extract these divs returned code can re-format , display them. code have far working, i'm not sure on how extract 'event' divs source code. ideas?

function getnotices(){     // date form     var str = document.getelementbyid('formdate').value;      var year = str.slice(1,4); // extract year     var month = str.slice(6,7); // extract month     var day = str.slice(9,10); // extract day      // inject correct date url     var link = "<a href=\"http://ilearn.stpauls.school.nz/calendar/view.php?view=day&course=1&cal_d=" + day + "&cal_m=" + month + "&cal_y=" + year + "\">raw link</a>";     // write raw link div debugging     document.getelementbyid('rawlink').innerhtml = link;  (debugging)      // bounce off anyorigin.com source     // re-inject date new link     var anylink = "http://anyorigin.com/get?url=http%3a//ilearn.stpauls.school.nz/calendar/view.php%3fview%3dday%26course%3d%26cal_d%3d" + day + "%26cal_m%3d" + month + "%26cal_y%3d" + year + "&callback=?"; // splice date school link , site bounce off     $.getjson('http://anyorigin.com/get?url=http%3a//ilearn.stpauls.school.nz/calendar/view.php%3fview%3dday%26course%3d1%26cal_d%3d30%26cal_m%3d7%26cal_y%3d2013&callback=?', function(data){         var obj = json.stringify(data); // turn object string         document.getelementbyid('hopefullythedata').innerhtml = obj; // print string containing spc website onto page (debugging)     }); } 

thanks guys!

you can append event nodes searching inside data.contents:

$('.event', data.contents).appendto('#hopefullythedata'); 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -