title: Update database from table cell without refreshing page
body: <p>I want to make editable cell in table, then when hit 'enter' update database without refreshing whole page.</p>
  
  <p>first of all I populate my table from sql query like:</p>
  
  <pre><code>//up there - no important things
  
  echo'&lt;table&gt; 
          &lt;tr&gt;';                  
          while($row = mysql_fetch_assoc($result))
          {                       
              foreach($row as $key=&gt;$value)
              {
                 if(!($value == "id_p" || $value == "pass" || $value == "salt" || $value == "login"))
                 {               
                 echo'&lt;th&gt;'.$value.'&lt;/th&gt;';
                 }
              }
          } 
          echo '&lt;/tr&gt;';
  
          if(mysql_num_rows($result2) &gt; 0)
          {
              while($row2 = mysql_fetch_assoc($result2))
              {                           
                  echo '&lt;tr&gt;';
                  foreach($row2 as $key=&gt;$value)
                  {                           
                      if(!($key == "id_p" || $key == "pass" || $key == "salt" || $key == "login"))
                         echo'&lt;td&gt;'.$value.'&lt;/td&gt;';
                  }
                  echo '&lt;/tr&gt;';
              }
          }
          else
              echo '&lt;tr&gt;&lt;td colspan="9"&gt;Brak wyników.&lt;/td&gt;&lt;/tr&gt;';
  
  echo'&lt;/table&gt;';
  </code></pre>
  
  <p>Then i change cell <code>&lt;td&gt;</code> with script (not my script) to </p>
  
  <pre><code>$(function(){
          $("td").click(function(event)
          {
              if($(this).children("input").length &gt; 0)
                      return false;
              var tdObj = $(this);
              var preText = tdObj.html();
              var inputObj = $("&lt;input type='text' /&gt;");
              tdObj.html("");
              inputObj.width(tdObj.width())
                  .height(tdObj.height())
                  .css({border:"0px",fontSize:"17px"})
                  .val(preText)
                  .appendTo(tdObj)
                  .trigger("focus")
                  .trigger("select");
              inputObj.keyup(function(event){
                  if(13 == event.which) // if ENTER
                  { 
                      var text = $(this).val();
                      tdObj.html(text);
  
   // SOMETHING HERE TO UPDATE DATABASE??
  
                  }
                  else if(27 == event.which) {  // if ESC
                          tdObj.html(preText);
                  }
                });
                  inputObj.click(function(){
                          return false;
                  });
          });
  });
  </code></pre>
  
  <p>And now i'm stuck. How can i send new data to update(without refreshing whole page)? I'm not good in js/ajax.
  i've created new page <code>update_db.php</code></p>
  
  <pre><code>if(isset($_POST['post_name']))
  {
     echo 'processing...';
    //mysql things...
  }
  </code></pre>
  
  <p>but this is all i have.</p>