Created
March 1, 2011 23:39
-
-
Save miku/850148 to your computer and use it in GitHub Desktop.
Rough sketch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><head></head> | |
<body> | |
<script type="text/javascript" src="https://www.google.com/jsapi?key=..."></script> | |
<script>google.load("jquery", "1.4.3");</script> | |
<script type="text/javascript"> | |
$(document).ready(function() | |
{ | |
$.ajax({ | |
url: "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Fapi.causes.com%2Fbeneficiaries%2F1239.xml'&format=json", | |
dataType: "json", | |
success: function(data) { | |
// `data` is actually a json structure (as requested) | |
// if you want to see it, just use | |
// console.log(data); | |
// now iterate over the json structure | |
// (see also: http://stackoverflow.com/q/1078118/89391) | |
// and set your target dom element as you like | |
// (the above is just a dummy ...) | |
$.each(data.query.results, function(i, key) { | |
var total = console.log(key['total-raised'].content); | |
$("target").html('<p>' + total + '</p>'); | |
}); | |
} | |
}); | |
}); | |
</script> | |
</body></html> | |
<!-- `data` looks something like this: | |
Object | |
query: Object | |
count: 1 | |
created: "2011-03-01T23:24:18Z" | |
lang: "en-US" | |
results: Object | |
beneficiary: Object | |
id: Object | |
name: "INTERNATIONAL FELLOWSHIP OF CHRISTIANS & JEWS" | |
recent-facebook-donors: "time1297716630facebook_id0nameRobert Alan Schoonoveramount200time1297372019facebook_id0nameCurtis En…" | |
total-causes: Object | |
total-donors: Object | |
total-members: Object | |
total-raised: Object | |
__proto__: Object | |
__proto__: Object | |
__proto__: Object | |
__proto__: Object | |
... | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment