title: Php and ajax not returning any data from database, no errors
body: <p>I have created a search using ajax and php, however when I click the search button nothing happens. There are no errors, however when I look at the network in the console it doesn't seem to be reaching searching.php as this file doesn't show up in the network. I want to be able to put the returned data from the search into seperate divs, although at the minute it isn't returning any data at all and I have no idea why. </p>
  
  <p>This is my php</p>
  
  <pre><code>require_once('config1.php');
  
  $output = '';
  if(isset($_POST['search']) === true &amp;&amp; empty($_POST['search']) === false){
  
  
  
      $query = "SELECT a.attraction_name, a.lat, a.long, a.cost, a.image FROM zz_attractions a INNER JOIN zz_city c ON a.city_id = c.city_id WHERE c.city_name = '" . mysqli_real_escape_string(trim($_POST['search'])) . "' ";
  
  
      $result = mysqli_query($conn, $query);
      $count = mysqli_num_rows($result);
  
      if ($count == 0) { 
          $output = 'there was no search results';
  
      } else {
          while ($row = mysqli_fetch_array($result)) { 
              $attraction_name = $row['attraction_name'];
              $lat = $row['lat'];
              $long = $row['long'];
              $cost = $row['cost'];
              $image = "&lt;img src='{$row['image']}' height='100' width='100'&gt;";
  
              $output .= '&lt;div&gt;'.$attraction_name.' '.$lat.' '.$long.' '.$cost.' '.$image.'&lt;/div&gt;';
  
          }
      }
  }
  </code></pre>
  
  <p>This is my ajax </p>
  
  <pre><code>$('#submit').on('click', function() {
      var search = $('#search').val();
  
      if ($.trim(search) != '') { //if search is not equal to nothing - using trim allows users to type in blank space and it won't return anything 
          $.post('searching.php', {search: search}, function(data) {
              $('#return').text(data);
          });
      }
  });
  </code></pre>
  
  <p>Within the html the div id is #return. If someone could help me find out why no data is returning that would be great. </p>