title: Difficulty displaying error message using AJAX jQuery API and PHP.
body: <p>I'm using the jQuery AJAX function in order to  retrieve data from my mySQL database without having to refresh the page. I have everything in working order, my query's are retrieving the correct data from my database. However, I am struggling to echo out an error message when no data can be retrieved based on the users input. I have a php file that provides the user interface for the user to search from, it also contains the following Scripts in the document head. <br/><br/> Here is what I have so far:- </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(function(){
      $('#users').keyup(function(){
          var inpvalue= $('#users').val();
      });
  });
  &lt;/script&gt;
  
  
  
  &lt;script type="text/javascript"&gt;
  $(function(){
              $('#users').keyup(function(){
  
              var inpval=$('#users').val();
  
              $.ajax({
                  type: 'POST',
                  data: ({p : inpval}),
                  url: 'data.php',
                  success: function(data) {
                       $('#output_div').html(data);
  
            }
          });
      });
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated, sorry if I haven't explained myself very well. 
  <br/>Thankyou.</p>