why cant the php function wait for the click instead
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/8239891/function-running-automatically-instead-of-a-click">function running automatically instead of a click</a>  </p>
</blockquote>



<p>Hi Guys I am trying so many ways of accomplishing something, I would like the php code run when the js finds that click event instead it runs on page load is there anyway of doing this please help:</p>

<pre><code>&lt;script&gt;
    jQuery('#next').click(function(){ 
        $(this).data('clicked', true); 
    });

    if(jQuery('#next').data('clicked')) {
        function stop() {   
            var stop_record = "&lt;?=$test-&gt;stoprec;?&gt;";
        }
    }
&lt;/script&gt;
</code></pre>
