PHP Classes

File: src/Response/Plugin/JQuery.php

Recommend this page to a friend!
  Classes of Thierry Feuzeu   Jaxon   src/Response/Plugin/JQuery.php   Download  
File: src/Response/Plugin/JQuery.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon
Call PHP classes from JavaScript using AJAX
Author: By
Last change:
Date: 5 years ago
Size: 1,345 bytes
 

Contents

Class file image Download
<?php

namespace Jaxon\Response\Plugin;

use
Jaxon\Response\Plugin\JQuery\Dom\Element;

class
JQuery extends \Jaxon\Plugin\Response
{
    use \
Jaxon\Features\Config;

   
/**
     * @inheritDoc
     */
   
public function getName()
    {
        return
'jquery';
    }

   
/**
     * @inheritDoc
     */
   
public function getHash()
    {
       
// Use the version number as hash
       
return '3.3.0';
    }

   
/**
     * @inheritDoc
     */
   
public function getReadyScript()
    {
        return
'
    jaxon.command.handler.register("jquery", function(args) {
        jaxon.cmd.script.execute(args);
    });
'
;
    }

   
/**
     * Create a JQuery Element with a given selector, and link it to the current response.
     *
     * Since this element is linked to a response, its code will be automatically sent to the client.
     * The returned object can be used to call jQuery functions on the selected elements.
     *
     * @param string $sSelector The jQuery selector
     * @param string $sContext A context associated to the selector
     *
     * @return Element
     */
   
public function element($sSelector = '', $sContext = '')
    {
       
$xElement = new Element($sSelector, $sContext);
       
$this->addCommand(['cmd' => 'jquery'], $xElement);
        return
$xElement;
    }
}