Created
September 25, 2012 04:22
-
-
Save pinktrink/3779966 to your computer and use it in GitHub Desktop.
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
$.ajax({ | |
dataType: 'jsonp', | |
jsonp: 'callback', | |
url: 'http://search.twitter.com/search.json?q=%23fwgangnamstyle', | |
success: function(obj) { | |
for (var i = 0; i <= obj.results.length - 1; ++i) { | |
var user = obj.results[i].from_user; | |
var tweet_text = obj.results[i].text.replace(/#[\w\d]+/g, "<a href=\"https://twitter.com/$&\" target=\"_blank\">"); | |
var html = "<li><a href=https://twitter.com/" + user + ">@" + user + "</a> said " + tweet_text + "</li>"; | |
console.log(obj.results[i]); | |
$("#tweet-feed ul").append(html); | |
}; | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Replace :
var tweet_text = obj.results[i].text.replace(/#[\w\d]+/g, "<a href="https://twitter.com/$&\" target="_blank">");
With :
var tweet_text = obj.results[i].text.replace(/#[\w\d]+/g, "<a href="https://twitter.com/$&\" target="_blank"> $& ");