title: Send input value to php using ajax with result printed to div
body: <p>I'm trying to send an input value to a php script and have the returned value posted to a div, using ajax, but I can't seem to get this right. Any help/suggestions would be appreciated. <strong>Thanks!!</strong></p>
  
  <p>This is what I have by now, but console says: "Failed to load resource: the server responded with a status of 404 (Not Found)".</p>
  
  <p><strong>test1.php:</strong></p>
  
  <pre><code>&lt;script&gt;
  $.ajax({
          type: 'POST', 
          url: 'test2.php',      
          data: {url: $('#id1').val()},         
          success: function (data)
          {
             $(document).ready(function(){$("#content").load("test2.php");});
          }
      });   
  &lt;/script&gt;
  
  &lt;form name="input"&gt;
  &lt;input type="text" id="id1"&gt;
  &lt;input type="submit"&gt;
  &lt;/form&gt;
  
  &lt;div id="content"&gt;&lt;/div&gt;
  </code></pre>
  
  <p><strong>test2.php:</strong></p>
  
  <pre><code>&lt;?php
  $string=$_POST['id1'];
  require_once('connect.php');
  $inf = "SELECT * FROM `comments` WHERE date='$string'";
  $info = mysql_query($inf);
  while($info2 = mysql_fetch_object($info)) {echo $info2-&gt;username.$info2-&gt;date;}
  ?&gt;
  </code></pre>