title: Call 'onClick' Code every time the page loads
body: <p>I have some php/html that creates a dynamic table with a set of links.  When the link is clicked it loads a page $url1 and called a function called 'update' which makes a mysql call. </p>
  
  <p>I am removing the table and modifying the mysql to return a single row. <strong>I want the code to 1)load the linked page ($url1) 2)run the update function that is called by onclick.</strong></p>
  
  <p><strong>Original Table</strong></p>
  
  <pre><code>        &lt;tr&gt;
              &lt;td&gt;&lt;?php echo $i; ?&gt;&lt;/td&gt;        
              &lt;td&gt;&lt;a href="&lt;?php echo $url1; ?&gt;" target="_blank" class="url" onclick="update('&lt;?php echo $row['node']; ?&gt;');"/&gt;Run&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $row['level1_text']." - ".$row['level2_text']." - ".$row['level3_text']." - ".$row['level4_text'] ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $row['last_run_date']; ?&gt;&lt;input type="text" class="node" value="&lt;?php echo $row['node']; ?&gt;" hidden&gt;&lt;/td&gt;
              &lt;td id="cnt"&gt;&lt;?php echo $row['run_count']; //$idate=explode(" ",$row['insertdate']); $bdate=explode("-",$idate[0]); echo $bdate[2]."-".$bdate[1]."-".$bdate[0];  ?&gt;&lt;/td&gt;
          &lt;/tr&gt;
  </code></pre>
  
  <p>I started with the 'update' function, i figured I could reduce the sql statement to return only 1 row and call the update function with this code. </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;update('&lt;?php echo $row['node']; ?&gt;');&lt;/script&gt;
  </code></pre>
  
  <p>That doesn't seem to work so I further simplified the code for testing but my update function is not being called. </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;update('525');&lt;/script&gt;
  </code></pre>
  
  <p>Any pointers?  Is there a good way call this function on page load and then load the page at $url?  </p>