Saturday, December 13, 2008

github api callback

Not documented on Official GitHub API Guide, GitHub provide "callback" parameter to allow corss-site json accessing.

Example in jQuery:
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js' type="text/javascript"></script>

<script>

function myFunction(data) {
// data is the json we would get
}

$.getScript("http://github.com/api/v1/json/username?callback=myFunction")

</script>


 

No comments: