
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 1.01 KB | hits: 12 | expires: Never
jquery ajax json
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
url: "https://api.github.com/repos/VonC/gitolite/git/refs/tags",
dataType: "jsonp", // I'm under the impression i should use jsonp, since this is a cross domain call
success: function (returndata)
{
$('.result').html(returndata);
alert('Load was performed.');
}
});
});
</script>
[
{
"object": {
"type": "commit",
"sha": "9accde83842523e18de320fc2f0a8efeaebef27b",
"url": "https://api.github.com/repos/jeffreycwitt/jeffswebpage/git/commits/9accde83842523e18de320fc2f0a8efeaebef27b"
},
"url": "https://api.github.com/repos/jeffreycwitt/jeffswebpage/git/refs/heads/master",
"ref": "refs/heads/master"
}
]
$.ajax({
url: "https://api.github.com/repos/VonC/gitolite/git/refs/tags",
dataType: "json",
success: function (returndata)
{
$("#result").html(returndata[0]["object"]["sha"]);
alert('Load was performed.');
}
});
returndata[0].object.sha