Pages

Friday, May 4, 2012

twitter call cq

a bit of code I've run up baseed on twitter search api. If you put #callcq tag in your post it will show up here by javascript magic. working on a map if you add geo coding data postcode, gps, QTH etc....
got the idea from http://www.twitwx.co.uk/.

I've stuck my first example on extra page on this site. but this is the main working. it wont run in a post.

<div id="results">
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
var url='http://search.twitter.com/search.json?callback=?&q=';
var query='%23callcq';;
  $.getJSON(url+query,function(json){
   $.each(json.results,function(i,tweet){
      $("#results").append('<p><img src="'+tweet.profile_image_url+'" widt="48" height="48" />'+tweet.text+'</p>');
   });
  });

});
</script>

No comments:

Post a Comment