PHP code example of anton-shevchuk / jquery-php

1. Go to this page and download the library: Download anton-shevchuk/jquery-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

anton-shevchuk / jquery-php example snippets




use function AntonShevchuk\jQuery\jQuery;
use function AntonShevchuk\jQuery\jQueryContainer;

// create jQuery-way queries
jQuery('#demo')
    ->html('Server time: ' . date('H:i:s'))
    ->css('backgroundColor', '#ffffdd')
    ->animate(['opacity' => 'show'], 3000)
    ->animate(['opacity' => 'hide'], 3000)
;

// return JSON
print json_encode(jQueryContainer());
shell
curl -sS https://getcomposer.org/installer | php
shell
php composer.phar install
html
<!-- Call $.php -->
<button onclick="$.php('index.php',{'action':'demo'});return false;">Run demo snippet</button>
<!-- Target DOM Element -->
<div id="demo">...</div>