title: No SQL data returned through jQuery ajax post
body: <p>I am having some issues returning data from on page, using jQuery, PHP and MySQL. I would like to show the query results on the index.php page. The results are fetched from the database using getResults.php.</p>
  
  <p>When I manually run the getResults.php?id=123 file, all works fine. In this case i'm seeing the results I would like to. However, when I want to post the 'id' 123 in a submit form on index.php, I don't see any results returned by jQuery / getResults.php. Only thing that changed is the URL: index.php?id=123. However, I'm not seeing any results or an error message...</p>
  
  <p>Any one an idea?</p>
  
  <p>getResults.php file</p>
  
  <pre><code>$search = mysql_real_escape_string( isset ($_POST['id']));
  
  if ($search) {
  $friend = mysql_query(  " SELECT * FROM reviews WHERE fbuserid = '$search' ORDER BY datumtijd DESC" );
  
  if ( $friend )  {   
      while ($row = mysql_fetch_array ($friend) ) {
              echo "Show some results...";
      }
  } else {
      echo "No matches found";
  }
  } else {
  echo "Query not succesfull";
  } 
  </code></pre>
  
  <p>index.php file</p>
  
  <pre><code>&lt;script type="text/javascript" charset="utf-8"&gt;
  
          $(document).ready(function() {
  
          $("#submit").click(function) {
              event.preventDefault();
              $.ajax({
                  url:"getResults.php",
                  type:"GET",
                  data: "id="+this.value,
                  success: function(data) {
                      $("#results").html(data);
                  }
              });
          }
          return false;
      });
  
      &lt;/script&gt;    
  
      &lt;div&gt;
          &lt;form&gt;
              &lt;input type="text" name="id"&gt;
              &lt;input type="submit" value="submit" id="submit"&gt;
          &lt;/form&gt;
      &lt;/div&gt;        
      &lt;div id="results"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>EDIT: 
  Thanks, all for your input. Nevertheless, I'm still not there... As you might notice, I'm not quite experienced with jQuery and PHP. See changes in scripts above. In short:
  - I added the false statement if ($query) is not succesfull;
  - Changed the $.post method into $.ajax;
  - Changed the GET into POST in the PHP file;</p>
  
  <p>Any other suggestions? </p>