title: replace div content with ajax
body: <p>hey ive got a working php script, and as far as i can tell my jquery ajax function mimics anything ive seen on SO, but somehow this wont work. im posting my HTML, php, and js. can someone please help me out here? ive been at this for days without success.</p>
  
  <p>on submit it seems as though the page flickers for a short (refresh?) period, but nothing happens.</p>
  
  <p>HTML/js:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Trade diving equipment online at DiveBay&lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css" href="dbstylesheet.css" /&gt;
  &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"&gt;
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  
  
  $(document).ready(function(){
      %("#searchdivebay").submit(function(){
  
          var word = $("#searchbox").val();
          $.ajax({
              type: "GET",
              url: "trysearch.php",
              data: $("#searchdivebay").serialize(),
              context: '#content',
              success: function(data){                
                              $(this).html(data);
                      }
          });
      });
  
  });
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;center&gt;
      &lt;div id="wrapper"&gt;
  
          &lt;div id="header"&gt;
              &lt;div id="hbackground"&gt;
                  &lt;img src="db3.jpg" alt="hbackground" width="100%" height="100%" style="z-index:1;" /&gt;
                  &lt;div id="htitle"&gt;
                      &lt;span class="banner"&gt;DIVEBAY.COM&lt;/span&gt;
                      &lt;span class="byline"&gt;GET INTO DIVING, TRADE DIVING EQUIPMENT ONLINE&lt;/span&gt;      
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div id="searchandlog"&gt;
              &lt;div id="search"&gt;
                  &lt;form id="searchdivebay" action="#" method="get"&gt;
                      &lt;div id="searchboxholder"&gt;&lt;input type="text" name="searchbox" id="searchbox" /&gt;&lt;/div&gt;
                      &lt;div id="searchbuttonholder"&gt;&lt;input type="submit" name="searchbutton" id="searchbutton" value="Search DiveBay"/&gt;&lt;/div&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
              &lt;div id="login"&gt;
                  &lt;ul class="signreg"&gt;
                      &lt;li&gt;&lt;i&gt;Existing user?&lt;/i&gt;&lt;a href="divebaylogin.html"&gt;SIGN IN&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;i&gt;or, new?&lt;/i&gt;&lt;a href="createaccount.html"&gt;REGISTER&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div id="searchresults"&gt;Search results for &lt;span id="searchword" class="word"&gt;&lt;/span&gt;&lt;/div&gt;
          &lt;div id="content"&gt;
  
  
          &lt;/div&gt;
          &lt;div id="sitemap"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/center&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php
  echo '
  &lt;?xml version = "1.0" encoding = "utf-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
  &lt;head&gt;
  &lt;title&gt;searchdbresults&lt;/title&gt;
  &lt;link rel="stylesheet" type = "text/css" href = "styledb.css" /&gt;
  &lt;/head&gt;
  
  &lt;body&gt;';
  
  $user = 'root';
  $pass = null;
  $pdo = new PDO('mysql:host=localhost; dbname=divebay;', $user, $pass);
  
  $search = $_GET['searchbox'];
  if($search == ""){
      echo '&lt;p style="color:black; font-size:18pt; font-family: Impact; "&gt; You didn"t search for anything!&lt;/p&gt;';
  }
  else{
  try{
      $stmt = $pdo-&gt;prepare('SELECT * FROM auction WHERE name LIKE ?');
      $stmt-&gt;bindValue(1, '%'. trim($search) .'%');
      $stmt-&gt;execute();
  
  
  
      $numrows = 0;
  
      echo '&lt;table id="showresult"&gt;';
  
      while($row = $stmt-&gt;fetch(PDO::FETCH_ASSOC)){
          $numrows++;
          $ID = $row['ID'];
          $img = $row['img'];
          $name = $row['name'];
          $owner = $row['owner'];
          $cprice = $row['cprice'];
          $iprice = $row['iprice'];
          $incprice = $row['incprice'];
          $etime = $row['etime'];
  
      echo '
      &lt;tr class = "resultindex"&gt;
          &lt;td class = "imgholder"&gt;' .$img. '&lt;/td&gt;
          &lt;td class = "infoholder"&gt;
              &lt;div style ="height:4px;"&gt;&lt;/div&gt;
              &lt;div class = "infodiv"&gt;'.$name.'&lt;/div&gt;
              &lt;div class = "locdiv"&gt;&lt;/div&gt;
              &lt;div class = "userdiv"&gt;&lt;span class="fromuser"&gt;From user: &lt;/span&gt;&lt;br/&gt;'.$owner.'&lt;/div&gt;
          &lt;/td&gt;
          &lt;td style = "width:2px; background-color:#330066;"&gt;&lt;/td&gt;
          &lt;td class ="priceholder"&gt;
              &lt;div class = "currentp"&gt;&lt;span class="currentbid"&gt;Current Bid: &lt;/span&gt;&lt;br/&gt;'.$cprice.'&lt;/div&gt;
              &lt;div class = "instantp"&gt;&lt;span class="instantbid"&gt;Instant Sale: &lt;/span&gt;&lt;br/&gt;'.$iprice.'&lt;/div&gt;
              &lt;div style = "height:5px;"&gt;&lt;/div&gt;
              &lt;div class = "incp"&gt;&lt;span class="nextbid"&gt;Next Bid:&lt;/span&gt;&lt;br/&gt;'.$incprice.'&lt;/div&gt;
          &lt;/td&gt;
          &lt;td style = "width:2px; background-color:#330066;"&gt;&lt;/td&gt;
          &lt;td class = "timer"&gt;&lt;span class="timeleft"&gt;Time Left: &lt;/span&gt;&lt;br/&gt;'.$etime.'&lt;/td&gt;
      &lt;/tr&gt;';
      }
      if($numrows == 0){
          echo '
          &lt;tr&gt;
          &lt;td colspan="4"&gt;Sorry your search for '.$search.' returned no results&lt;/td&gt;
      &lt;/tr&gt;';
      }
      else{
          echo '
          &lt;tr&gt;
          &lt;td colspan="4"&gt;Displaying'.$numrows.'results&lt;/td&gt;
  
      &lt;/tr&gt;';
      $pdo = null;
      }
      }catch(PDOException $e){
          echo $e-&gt;getMessage();
      }
      }
      echo '
      &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;';
  
  ?&gt;
  </code></pre>