Switch to full style
JQuery Examples
Post a reply

Load tweets using JQuery

Thu Jan 10, 2013 1:08 am

Load tweets using JQuery
javascript code
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Microsoft jQuery template</title>
<link rel="stylesheet" href="website.css" />
<!-- You can download it -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="jquery.tmpl.js"></script>
</head>
<body>

<h1> Load tweets about something to your webpage. </h1>

<script id="tweets" type="text/x-jquery-tmpl">
<li>
<img src="${imgSource}" alt="${userName}" />
<h2> ${username} </h2>
<p> ${tweet} </p>

{{if geo}}
<span>
${geo}
</span>
{{/if}}
</li>
</script>

<ul id="twitter"></ul>

<script>
$.ajax({
type : 'GET',
dataType : 'jsonp',
url : 'https://twitter.com/search?q=%20Washington%20Post&src=typd',

success : function(tweets) {
var twitter = $.map(tweets.results, function(obj, index) {
return {
username : obj.from_user,
tweet : obj.text,
imgSource : obj.profile_image_url,
geo : obj.geo
};
});

$('#tweets').tmpl(twitter).appendTo('#twitter');
}
});

</script>
<div id="tweets" ></div>
</body>
</html>




Post a reply
  Related Posts  to : Load tweets using JQuery
 Load RSS feeds and parse it with JQuery     -  
 Load Content to Tabs using AJAX and JQuery     -  
 Load file and update content using AJAX and JQuery     -  
 load class to applet- load frame class to applet     -  
 help me How do I load image from my pc to matlab     -  
 How to Load Files using JFileChooser!!     -  
 calculate the load time for a page     -  
 J2me Image load Exception     -  
 how to load the form elements depending on selection option     -  
 Add double quotes to text dynamically, on page load     -  

Topic Tags

JQuery GET/POST