title: Run another javascript when user clicks "ok" on alertbox
body: <p>Basically I have a script that checks database every 10 seconds and notifys user if data has changed with a javascript alert box. But I need the database also to be changed when user has seen the alert and clicked OK. So is it possible to make a javascript function run when user clicks "OK" on javascript alert? </p>
  
  <p>So for example </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
  function show_alert()
  {
  alert("New data!");
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;input type="button" onclick="show_alert()" value="Show alert box" /&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And when user clicks OK it should run this function</p>
  
  <pre><code>  function UpdateDB()
    {
        jQuery.ajax({
         type: "POST",
         url: "update.php",
         data: 'condition=ok',
         cache: false,
  
       });
   }
  </code></pre>