How are you posting the user's credentials to the
/favorites/(create/destroy) calls?  And how are you avoiding the
cross-domain ajax limitation?
-Chad

On Thu, Apr 16, 2009 at 2:35 PM, Dr. Drang <[email protected]> wrote:
>
> I'm writing a Twitter webapp using jQuery. One of the features is the
> ability to toggle the Favorite status of a tweet. The function looks
> like this:
>
> function toggleFavorite(msg_id) {
>  $.getJSON("http://twitter.com/statuses/show/"; + msg_id + ".json",
>    function(data){
>      if (data.favorited) {
>        $.post('http://twitter.com/favorites/destroy/' + msg_id +
> '.json',
>          {id:msg_id},
>          function(post_return){
>            $('#msg-' + msg_id + ' a.favorite').css('color', 'black');
>          }
>        );
>      }
>      else {
>        $.post('http://twitter.com/favorites/create/' + msg_id +
> '.json',
>          {id:msg_id},
>          function(post_return){
>            $('#msg-' + msg_id + ' a.favorite').css('color', 'red');
>          }
>        );
>      }
>    }
>  );
> }
>
> This used to work fine. But recently (I don't know when it started and
> I don't know whether it's due to a change in the API or a change I
> made elsewhere in my code) the "favorited" field began to always
> return false, even if the tweet had been favorited by the user. The
> getJSON call seems to be behaving like
>
>    curl http://twitter.com/statuses/show/msg_id.json
>
> instead of
>
>    curl -u user:password http://twitter.com/statuses/show/msg_id.json
>
> Is there some way to incorporate the user's Twitter ID into the
> getJSON call to statuses/show?
>

Reply via email to