PHP code example of g33kme / pquery

1. Go to this page and download the library: Download g33kme/pquery 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/ */

    

g33kme / pquery example snippets




/*
 * This is some basic example on your ajax.php
 * Of course you can do whatever your want
 */

//Highly recommend to clean your sent parameter requests, PQuery will help
jax request
//Depending on our task we can do whatever we want todo

switch($request[task]) {

	case 'geekme':
	    
	    //Attached parameters on ajax url
        $task = $request['task'];
        $param1 = $request['param1'];
        $param2 = $request['param2'];
                
	    //Form element parameters
        $name = $request['name'];
        $geek = $request['geek'];
        
        //Form element hidden inputs
        $id = $request['id'];
        $jloader = $request['jloader'];
        
        //All echo will be ajaxed to your content
        echo 'My password is the last 8 Digits of π';
        
        //We also passed here our jloader for the loader indicator and if we finish our task we may want to hide
        //Because your content gets loaded via AJAX you can use jQuery without loading again
        
html
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"></head>
<body>

    
        
        // You can attach parameters directly to your ajax.php 
        // You can also create a mix with via this parameters and HTML form elements
        
        $params = '?task=geekme&param1=value1&param2=value2';
        $url = 'path/to/your/ajax.php'.$params;
        
        $update = '#myid';
        $jloader = '#jloaderid';
        
        echo PQUERY::form(array(
            'url' => $url,
            'update' => $update,
            'type' => 'POST',
            'name' => 'myform_name',
            'id' => 'myform_id',
            'class' => 'myform_class'
        ));
    
html
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"></head>
<body>



    $update = '#myid';
    $jloader = '#jloaderid';
    
    $params = '?task=link-me&param1=value1&key=value&jloader='.$jloader;
    $url = 'path/to/your/ajax.php'.$params;
    
    echo PQUERY::link(array(
        'url' => $url,
        'update' => $update,
        'jloader' => $jloader,
        'name' => 'Ajax Me!',
        'id' => 'setsomeid',
        'class' => 'setsomeclass'
    ));