As far twitter API goes, it works fine.I implemented in C#. you can see it
here.

http://www.byteblocks.com/post/2009/05/22/Verify-if-two-twitter-users-are-friends.aspx

May be some JS guru can look thru code and suggest some change.

On Tue, Jun 9, 2009 at 6:16 AM, grand_unifier <jijodasgu...@gmail.com>wrote:

>
> this has been bothering me for quite some tym now...i have written a
> code which inputs two usernames(twitter id) n will o/p if both are
> friends or not...
> the api doc for thsi response is here...
>
> http://apiwiki.twitter.com/Twitter-REST-API-Method:-friendships-exists
>
> <!-- this is the javascript json parser function -->
>
>    <script type="text/javascript" src="../jquery-1.2.6.min.js">
>    </script>
>
>    <script type="text/javascript">
>
>    $(document).ready(function()
>     {
>                $('form#search').bind("submit", function(e)
>                {
>                        e.preventDefault();
>                        $('#content').html('');
>
>                        var query1 = urlencode($('input[name="user_a"]').val
> ()); //userA
>                        var query2 = urlencode($('input
> [name="user_b"]').val()); //userB
>
>                        $.ajax( {
>                                           url: 'http://twitter.com/
> friendships/exists.json?user_a='+<http://twitter.com/%0Afriendships/exists.json?user_a=%27+>
>                                                                query1 +
> '&user_b=' + query2,
>                                           dataType: "jsonp",
>                       success: function(data)
>                       {
>                                                        if(data ==
> true)
>                                                        {
>                                                                var
> newDiv = '<p>true</p>';
>                                                        }
>
>                                $('#content').append(newDiv);
>                       }
>
>                       });
>
>
>                        });
>                })
>
>          function urlencode(str) {
>            return escape(str).replace(/\+/g,'%2B').replace(/%20/g,
> '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');
>          }
>    })
>
>    </script>
>
> <!-- javascript ends here -->
>
> the json returns true or false....but still it doesnt seem to work....
> can anyone refine the code???
>
>


-- 
Naveen K Kohli
http://www.netomatix.com

Reply via email to