Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 1.70 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. getJSON error in Firefox
  2. <?php $searchText = $_REQUEST["searchText"]; ?>
  3.  
  4. <script type="text/javascript">
  5. $('.facebookfeed').append('<p>Loading your results</p>');
  6.   var url = 'https://graph.facebook.com/search?q=';
  7.   var url = url+searchText.value;
  8.   var url = url+'&type=post&limit=60&callback=?';      
  9.     $.getJSON(url,function(json){
  10.     console.log(data);
  11.         var html = "<ul>";
  12.             if (json.data == ''){html += '<li><h2>Sorry, no results were found. Try with another search term.</h2>'; }
  13.         $.each(json.data,function(i,fb){
  14.             if (!fb.message == ''){
  15.                 html += '<li><div class="box">'
  16.                 html += '<a href="http://www.facebook.com/'+ fb.from.id +'" target="_blank"><img src="https://graph.facebook.com/' + fb.from.id + '/picture" /></a>';
  17.                 html += '<p><span class="name"><a href="http://www.facebook.com/'+ fb.from.id +'" target="_blank">' + fb.from.name + '</a></span>  <br />';
  18.                 html += fb.message;
  19.                 html += '</p></div></li>';
  20.  
  21.             }
  22.             });
  23.         html += "</ul>";
  24.         $('.facebookfeed').animate({opacity:0}, 500, function(){
  25.                 $('.facebookfeed').html(html);
  26.                                                               });
  27.         $('.facebookfeed').animate({opacity:1}, 500);
  28.  
  29.     });
  30.  
  31.  
  32. </script>
  33.        
  34. Error: searchText is not defined
  35.        
  36. <script type="text/javascript">
  37.     $('.facebookfeed').append('<p>Loading your results</p>');
  38.     var searchText = "<?= $searchText?>";
  39.     var url = 'https://graph.facebook.com/search?q=';
  40.     url = url+searchText;
  41.     url = url+'&type=post&limit=60&callback=?';  
  42.     $.getJSON(url,function(json){
  43.         ...    
  44.     });
  45.     ...
  46. </script>