title: call a php function with a click of a button
body: <p>how do you call a php function with ajax or javascript or jquery?</p>
  
  <p>this is my php script </p>
  
  <pre><code>function submitmessage() {
      $sent = date(y-m-d-h-m-s);
      $message = $_POST['message'];
      $query = "INSERT INTO chatbox (from,to,message,sent)                            
      VALUES('$fullname','$to','$message','$sent')";
      mysql_query($query) or die(mysql_error());
  }
  </code></pre>