Created
April 7, 2012 10:37
-
-
Save thinkphp/2327342 to your computer and use it in GitHub Desktop.
JSONP Light Usage
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
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