Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created March 21, 2012 12:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinkphp/2146639 to your computer and use it in GitHub Desktop.
Save thinkphp/2146639 to your computer and use it in GitHub Desktop.
jsonp2 usage
var tpl = "<li><a href='http://twitter.com/{from_user}'>{from_user}</a> {text}<span>{created_at}</span></li>",
urltwitter = 'http://search.twitter.com/search.json?q=mootools&rpp=5&callback=?';
new Jsonp(urltwitter, 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
}).fetch();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment