Call function with parameters - problem

Call function with parameters - problem

Having problems executing the function runupdate (line 26)



Example page


Jquery code call function
  1. <script>
  2.         
  3.     $(function() {   
  4.         // Function to read #log div
  5.         function runupdate(personsIDval) {
  6.             alert('inside runupdate function');
  7.              var events = [];
  8.              var idRE = /^Event ID : (\d+).*$/;
  9.              $('#log div').each(function() {
  10.                    events.push(idRE.exec($(this).text())[1]);
  11.              });
  12.              $.get('runupd.php', {personsID: personsIDval, eventsID: events}, function(data) {
  13.                   
  14.              });
  15.         }
  16.        
  17.     });   
  18.      
  19.     $(function(){
  20.         //Click button to run function - will loop thru the #log div
  21.          $("input#runupdate2").click(function(){
  22.          $('#log div').each(function(i) {
  23.           var text = $(this).text();
  24.           // call and send variable to function
  25.           var personsIDnr = '007'
  26.           runupdate(personsIDnr);
  27.         });
  28.         
  29.       });
  30.     });
  31. </script>

Program : runupd.php
  1. <?php
        // program : runupd.php
        // Do mysql select update etc.... 
        echo $personsID;
        echo $eventsID;
        print_r ($_GET);
        sleep(30);
    ?>