public function replaceElementUsingLink( $execMethod, $args = [ ], $targetDiv, $linkText, $anchorAttrs = [ ] )
    {
        $url = $this->url( $execMethod, $args, true );
        $attrs = [ ];
        foreach ($anchorAttrs as $k => $v) {
            $attrs[ ] = "{$k}='{$v}'";
        }
        $attrsStr = implode( ' ', $attrs );
        return <<<EOS
        <script type="application/javascript">
            if( typeof(execLink) != "function" ){
                var execLink = function( url, targetDiv ){
                    // Send the data using post
                    var posting = $.get( url, $( form ).serialize() );
                 
                    // Put the results in a div
                    posting.done(function( data ) {
                        $( "#"+targetDiv ).replaceWith( data );
                        $("body").css("cursor", "default");
                    });
    
                    // Show optional progress
                    $("body").css("cursor", "progress");
                }
            }
        </script>
        <a href="#" onclick="execLink( '{$url}', '{$targetDiv}' ); return false;" {$attrsStr}>{$linkText}</a>
EOS;
    }
public function replaceElementUsingLink( $execMethod, $args = [ ], $targetDiv, $linkText, $anchorAttrs = [ ] )
    {
        $url = $this->url( $execMethod, $args, true );
        $attrs = [ ];
        foreach ($anchorAttrs as $k => $v) {
            $attrs[ ] = "{$k}='{$v}'";
        }
        $attrsStr = implode( ' ', $attrs );
        return <<<EOS
        <script type="application/javascript">
            if( typeof(execLink) != "function" ){
                var execLink = function( url, targetDiv ){
                    // Send the data using post
                    var posting = $.get( url, $( form ).serialize() );
                 
                    // Put the results in a div
                    posting.done(function( data ) {
                        $( "#"+targetDiv ).replaceWith( data );
                        $("body").css("cursor", "default");
                    });
    
                    // Show optional progress
                    $("body").css("cursor", "progress");
                }
            }
        </script>
        <a href="#" onclick="execLink( '{$url}', '{$targetDiv}' ); return false;" {$attrsStr}>{$linkText}</a>
EOS;
    }
public function replaceElementUsingLink ( $ execMethod , $ args = [ ] , $ targetDiv , $ linkText , $ anchorAttrs = [ ] ) { $ url = $ this -> url ( $ execMethod , $ args , true ) ; $ attrs = [ ] ; foreach ( $ anchorAttrs as $ k => $ v ) { $ attrs [ ] = "{$k}='{$v}'" ; } $ attrsStr = implode ( ' ' , $ attrs ) ; return  <<<EOS
        <script type="application/javascript">
            if( typeof(execLink) != "function" ){
                var execLink = function( url, targetDiv ){
                    // Send the data using post
                    var posting = $.get( url, $( form ).serialize() );
                 
                    // Put the results in a div
                    posting.done(function( data ) {
                        $( "#"+targetDiv ).replaceWith( data );
                        $("body").css("cursor", "default");
                    });
    
                    // Show optional progress
                    $("body").css("cursor", "progress");
                }
            }
        </script>
        <a href="#" onclick="execLink( '{$url}', '{$targetDiv}' ); return false;" {$attrsStr}>{$linkText}</a>
EOS ; }
Generate a link which replaces the content of a DOM element with the output of an exec method
@param $execMethod
@param array $args
@param $targetDiv
@param $linkText
@param array $anchorAttrs
@return string
Generate a link which replaces the content of a DOM element with the output of an exec method