Jump to content

wats wrong wth this json parsing code


jijodasgupta

Recommended Posts

<!-- 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
            		var rpp = 20; //number of tweets to retrieve out
            
            		$.getJSON('http://twitter.com/friendships/exists.json?user_a='+query1+'&user_b='+query2, 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 -->

 

http://twitter.com/friendships/exists.json?user_a='+query1+'&user_b='+query2

 

the json response will contain just one word that is "true" or "false"...

this looks perfect but is not at all workin...if anyone can find faults in it...plz correct or atleast point out...

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.