Looping through getJSON
Looping through getJSON
I'm trying to get this example working, but I keep getting invalid label. I want to loop through the twitter search feed an get the text values.
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$.getJSON("http://search.twitter.com/search.json?q=twitter&jsoncallback=?", function(j) {
for (var i=0; i<=j.length; i++) {
$("#tweet").append('<h2>' + j.results[i].text + '</h2>');
}
});
});
</script>
</head>
<body>
<div id="tweet"></div>
</body>
</html>
The response in firebug looks like this:
{"results":[{"text":"some text that i want here","from_user":"Bill".....