如何从Jquery模式窗体发送响应到php函数?

I am using the basic modal confirmation example but when I user clicks on the Approvebutton, I want it to execute the php function Approve();

<script>
$( function() {
$( "#dialog-confirm" ).dialog({
  resizable: false,
  height: "auto",
  width: 400,
  modal: true,
  buttons: {
    "Approve": function() {
      $( this ).dialog( "close" );
    },
    Cancel: function() {
      $( this ).dialog( "close" );
    }
  }
});
} );
</script>



echo "<a href='test.php?cmd_test=approve_ts&test_id=$test_id'>Approve</a>";

 if (isset($_GET["cmd_test"]))
 {
    $test_id = $_GET['test_id'];    
    //do other stuff
 }

Create a PHP script. I'll call it ajax.php. In that, put your PHP code.

<?php
if (isset($_GET["cmd_test"]))
{
    $test_id = $_GET['test_id'];    
    //do other stuff
}
?>

Then, as others have said, use an AJAX request.

$.get('ajax.php', function (data) {
    // do stuff here
});

Put that in your Approve/Cancel functions