Hi,
I'm cofounder of Tipjoy - we just made payment on twitter. Check it
out: http://tipjoy.com/twitter
We have a fun project related to this that I'm working on right now.
I'm using jquery to parse the twitter account info from the API.
Disclaimer: I'm learning javascript JIT.
There is either a bug in my javascript, or the return from the twitter
API is wrong.
Here is some simplified code:
$(document).ready(function(){
var url = "http://twitter.com/users/show/" + [the username] +
".json?callback=?";
$.getJSON(url,
function(data){
if( data.error ){
alert("username doesn't exist")
}
else{
alert("that username exists")
}
}
);
});
This code uses jquery's getJSON to grab the account info for a given
username.
The return for a correct username is:
({...});
That wrapping is to pass it to the callback unnamed function.
But this code doesn't work for a username that doesn't exist. The
function doesn't even get called, and the alert doesn't show up.
Putting this is a browser
http://twitter.com/users/show/someBadUsername.json?callback=?
Returns:
{"request":"\/users\/show\/someBadUsername.json?
callback=?","error":"Not found"}
Should that be wrapped in ({...}); ? Is that a bug on twitter's side?
Or is there something I'm doing wrong in jquery?
I looked at the code for this project, and it looks like they are
using jquery to access summize in the same way I'm grabbing from the
twitter api.
http://tweet.seaofclouds.com/
http://github.com/seaofclouds/tweet/tree/master/javascripts/jquery.tweet.js
Any help would be greatly appreciated.
Thanks,
Ivan
http://tipjoy.com