如何将当前符号表中的数据放入ajax响应?

I'm getting data via AJAX. When I get response, I want to put variables from current symbol table (which I get from extract($this->args)) to ajax-response. The ajax.php is something like:

<div class="modal fade <?php echo $class; ?>" id="<?php echo $id; ?>" tabindex="-1" role="dialog" aria-hidden="true"></div>

So the variables in ajax.php should be replaced by variables from current symbol table. This is my code:

private function generate_js( $call_selector, $modal_id ) {
    ob_start();
            extract($this->args);             ?>        
    $("<?php echo $call_selector; ?>").click(function(e){ 
            e.preventDefault();

             if (!jQuery('#<?php echo $modal_id; ?>').length) { 
             jQuery.when(
               jQuery.ajax({
               url: 'ajax.php',
               success: function(response) {
                     jQuery(response).appendTo(jQuery('body'));
                   }
               })).done( function (){
                        jQuery('#<?php echo $modal_id; ?>').modal('show');                                     
                        }); 

            }
            }); 

But unfortunately I get only:

<div class="modal fade " id tabindex="-1" role="dialog" aria-hidden="true"></div>

Any solutions? Thanks! P.S. Vars in current symbol table do exist.

You are not sending your variables trough AJAX - so you are not receiving them back. You should rewrite your code like this:

<?php
private function generate_js( $call_selector, $modal_id ) 
{
  ob_start();
  extract($this->args); ?>        
  $("<?php echo $call_selector; ?>").click(function(e)
  { 
    e.preventDefault();

    if (!jQuery('#<?php echo $modal_id; ?>').length) 
    { 
      jQuery.when(
        jQuery.ajax({
          url: 'ajax.php?id=<?php echo $id; ?>&class=<?php echo $class; ?>',
          success: function(response) 
          {
            jQuery(response).appendTo(jQuery('body'));
          }
        })
      ).done( function (){
        jQuery('#<?php echo $modal_id; ?>').modal('show');                                     
    }); 
  }
}); 

and also change your ajax.php like this:

<div class="modal fade <?php echo $_GET['class']; ?>" id="<?php echo $_GET['id']; ?>" tabindex="-1" role="dialog" aria-hidden="true"></div>