Reputation: 191
I am trying to parse a website into an iOS application... Parsing the html tags works fine with hpple, but i want to parse the site after Java scripts and other server side scripts are run... How would I go about doing this?
This is the Java script run on site launch... I NEED THIS ONE, $('h1').html(sd.number);
$(document).ready(function() {
var names = "";
var today = new Date();
$.getJSON('space.json', function(sd) {
$('h1').html(sd.number);
$.each(sd.people, function(key, val) {
var launch = new Date(val.launchdate);
var diff = new Date(today - launch);
var days = Math.floor(diff/1000/60/60/24);
names += ('<a href="' + val.bio + '" target="_blank"><div class="item cf"><div class="person-name"><h2>' + val.name + '</h2><div class="flag '+ val.country +'"></div><h3>' + val.title + '</h3></div><div class="person-days"><h4>' + days + '</h4><p>Days in space</p> </div></div></a>');
});
$('#listing').html(names);
});
});
Upvotes: 1
Views: 240
Reputation: 5015
Make an HTTP Request (Without parsing anything) to the full URL of space.json (add the missing prefix). should end up looking something like http://www.yourdomain/space.json. then, just deserialize the JSON Response as usual.
Upvotes: 1