Thu Jan 10, 2013 1:08 am
<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>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.