After requesting a list of approved tweets from a webserver in JSON format, I visited the URL:
http://localhost:8000/showtweets/?after_id=354210796420608003
and received the following JSON response:
[{
"date": "2013-07-08T12:10:09",
"text": "#RaspberryPi ist auf dem Weg :-)",
"author_pic_url": "http://a0.twimg.com/profile_images/1315863231/twitter_normal.jpg",
"id": 354210796420608004,
"author": "switol"
}]
The tweet has an id of: 354210796420608004
.
However, when I tried to retrieve more tweets using a GET call in Javascript, something strange happened:
function TweetUpdater() {
}
TweetUpdater.latest_id = 0;
TweetUpdater.undisplayed_tweets = new Array();
TweetUpdater.prototype.get_more_tweets = function () {
var get_tweets_url = "/showtweets/?after_id="+TweetUpdater.latest_id;
$.get(get_tweets_url, function (tweets) {
if (tweets.length > 0) {
/////////////////////////////////////////////////////////
alert(tweets[0].id+", "+ tweets[0].text); <<<<< THIS LINE
/////////////////////////////////////////////////////////
TweetUpdater.latest_id = tweets[0].id;
for (var i = 0; i < tweets.length; i++) {
TweetUpdater.undisplayed_tweets.push(tweets[i]);
}
}
}, "json");
};
This code unexpectedly alerts:
354210796420608000, #RaspberryPi ist auf dem Weg :-)
It seems that the ids are not matching up correctly:
354210796420608004 != 354210796420608000
A peculiar situation indeed.