jijodasgupta Posted June 5, 2009 Share Posted June 5, 2009 <!-- 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 https://forums.phpfreaks.com/topic/161054-wats-wrong-wth-this-json-parsing-code/ Share on other sites More sharing options...
roopurt18 Posted June 5, 2009 Share Posted June 5, 2009 Make sure the JSON you're receiving from the server is valid. Link to comment https://forums.phpfreaks.com/topic/161054-wats-wrong-wth-this-json-parsing-code/#findComment-850168 Share on other sites More sharing options...
jijodasgupta Posted June 6, 2009 Author Share Posted June 6, 2009 its completely valid but still there its not displayin anything..... Link to comment https://forums.phpfreaks.com/topic/161054-wats-wrong-wth-this-json-parsing-code/#findComment-850415 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.