Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created April 7, 2012 10:37
Show Gist options
  • Save thinkphp/2327342 to your computer and use it in GitHub Desktop.
Save thinkphp/2327342 to your computer and use it in GitHub Desktop.
JSONP Light Usage
var tpl = "<li><a href='http://twitter.com/{from_user}'>{from_user}</a> {text}<span>{created_at}</span></li>";
var url = 'http://search.twitter.com/search.json';
JSONP.get(url, {q: 'mootools', rpp: 10}, function(data){
var result = data.results,
out = '<ul>'
for(var i in result) {
out += template(tpl,result[i])
}
out += '</ul>'
document.getElementById('result-twitter').innerHTML = out
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment