Twig/JqueryAjaxExtension.php
public function linkTag($options = array())
    {
        $jsRequest = $this->remoteCall();
        
        return function ($options) use($jsRequest)
        {
            $confirm = '';
            if (isset($options['confirm']) && $options['confirm'] === true) {
                
                $msg = "Are you sure you want to perform this action?";
                if(isset($options['confirm_msg'])) {
                    $msg = htmlentities(str_replace("'", '"', $options['confirm_msg']), ENT_QUOTES);                  
                }
            	$confirm .= "if(confirm('".$msg."'))" ;
            }
            $html = '<a class="' . (isset($options['class']) ? $options['class'] : "") . '"
    		 		 id="' . (isset($options['id']) ? $options['id'] : "") . '"
    		 		 href="' . $options['url'] . '"
    				 onclick="' .$confirm. call_user_func($jsRequest, $options) . 'return false;">';
            $html .= $options['text'];
            $html .= '</a>';
            
            return $html;
        };
    }
public function linkTag($options = array())
    {
        $jsRequest = $this->remoteCall();
        
        return function ($options) use($jsRequest)
        {
            $confirm = '';
            if (isset($options['confirm']) && $options['confirm'] === true) {
                
                $msg = "Are you sure you want to perform this action?";
                if(isset($options['confirm_msg'])) {
                    $msg = htmlentities(str_replace("'", '"', $options['confirm_msg']), ENT_QUOTES);                  
                }
            	$confirm .= "if(confirm('".$msg."'))" ;
            }
            $html = '<a class="' . (isset($options['class']) ? $options['class'] : "") . '"
    		 		 id="' . (isset($options['id']) ? $options['id'] : "") . '"
    		 		 href="' . $options['url'] . '"
    				 onclick="' .$confirm. call_user_func($jsRequest, $options) . 'return false;">';
            $html .= $options['text'];
            $html .= '</a>';
            
            return $html;
        };
    }
Generate link tag with js function to send ajax request

@param array $options