PHP Classes

Easy Ajax Builder with PHP: Generate HTML and JavaScript to send AJAX requests

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 67%Total: 403 All time: 6,543 This week: 60Up
Version License PHP version Categories
easy-ajax-builder 1.2GNU General Publi...5HTML, PHP 5, Debug, AJAX
Description 

Author

This class can generate HTML and JavaScript to send AJAX requests to PHP scripts.

It can take the URL of a given PHP script that will handle the AJAX requests and generates HTML with JavaScript to send the AJAX requests using jQuery.

Custom parameter values may be added to the request by constant value or taken from a given page element.

The generated JavaScript can make a given callback function be called when the AJAX request response is received.

It can also defined the elements that will change its CSS class while the request response is not received.

The class makes messages be outputted to the JavaScript console in debug mode.

Picture of pooya sabramooz
  Performance   Level  
Name: pooya sabramooz is available for providing paid consulting. Contact pooya sabramooz .
Classes: 4 packages by
Country: Iran Iran
Age: 33
All time rank: 150519 in Iran Iran
Week rank: 225 Up4 in Iran Iran Up
Innovation award
Innovation award
Nominee: 2x

Winner: 2x

Example

<?php
   
include 'AjaxBuilder.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>AjaxBuilder</title>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
</head>
<body>

<div class="container">

<h2>Ajax Builder
    <small>Multi Purpose use jQuery (or javascript ) Ajax With Ajax Builder</small>
</h2>
<p><small>Build Ajax apps Without Write Even one line jQuery (or javascript)</small></p>

<h3>Examples : </h3>
<hr>

<div class="row">
   <div class="col-sm-6">
        <h4>1- Basic Info</h4>

        <form method="get" class="form-horizontal col-sm-8">

            <label for="f_name">First Name : </label><input class="form-control" type="text" name="f_name">
            <label for="l_name">Last Name : </label><input class="form-control" type="text" id="l_name"><br>
            <div class="text-center">
                <input type="button" name="go" value="Submit" class="btn btn-success">
            </div>

        </form>
        <div class="col-sm-12" id="result"></div>

        <div class="col-sm-11">
            <h4>How to use</h4>
            <pre><code>
   &lt;?php

       $obj = new AjaxBuilder("POST","AjaxResponse.php");
       $obj->hasScript();
       $obj->hasReady();
       $obj->hasEvent("click","[name=go]");
       $obj->addParamWithName("f_name");
       $obj->addParamWithId("l_name");
       $obj->addLoading("[name=go]","disabled");
       $obj->debugMode();
       $obj->go("basic_info",false);

   ?&gt;
             </code></pre>
        </div>

        <?php
             $obj
= new AjaxBuilder("POST","AjaxResponse.php");
            
$obj->hasScript();
            
$obj->hasReady();
            
$obj->hasEvent("click","[name=go]");
            
$obj->addParamWithName("f_name");
            
$obj->addParamWithId("l_name");
            
$obj->addLoading("[name=go]","disabled");
            
$obj->debugMode();
            
$obj->go("basic_info",false);
       
?>
</div>
   <div class="col-sm-6">

        <h4>2- Server Clock</h4>
        <div id="result2" class="col-sm-12 text-success" style="font-size: 25px;margin: 30px"><?= date("Y/m/d - h:i:s",time()); ?></div>

        <div class="col-sm-10">
            <h4>How to use</h4>
            <pre><code>
   &lt;?php

        $obj = new AjaxBuilder("GET","AjaxResponse.php");
        $obj->addParamWithNameAndValue("getTime",1);
        $obj->go("clock_return",true);

   ?&gt;
            </code></pre>
        </div>

   </div>
   <div class="clearfix"></div>

   <h3>Features : </h3>

   <hr>
   <ul class="list-unstyled">
        <li><span class="glyphicon glyphicon-check"></span> 1. you can use both GET and POST method</li>
        <li><span class="glyphicon glyphicon-check"></span> 2. you can add trigger with any event and any selector</li>
        <li><span class="glyphicon glyphicon-check"></span> 3. you can add parameter with 4 ways : id,class,name and pair of name/value</li>
        <li><span class="glyphicon glyphicon-check"></span> 4. you can get result in function that you defined</li>
        <li><span class="glyphicon glyphicon-check"></span> 5. you can set loading options easily</li>
        <li><span class="glyphicon glyphicon-check"></span> 6. you can use debug mode to see all events in console log</li>
   </ul>


</div>

    <footer class="text-center text-primary" style="font-size: 12px;">
        2016 &copy; Pooya Sabramooz [pooya_alen1990@yahoo.com] <a target="_blank" href="https://github.com/pooya-alen1990">GitHub</a>
    </footer>

</div>
<script>
   

setInterval(function(){

<?php
    $obj
= new AjaxBuilder("GET","AjaxResponse.php");
   
$obj->addParamWithNameAndValue("getTime",1);
   
$obj->go("clock_return",true);
?>

},1000);


function basic_info(data){
    $("#result").html(data);
}

function clock_return(data){
    $("#result2").html(data);
}
</script>

</body>
</html>


Screenshots  
  • AjaxBuilder.png
  Files folder image Files  
File Role Description
Plain text file AjaxBuilder.php Class Class source
Accessible without login Plain text file AjaxResponse.php Aux. Auxiliary script
Accessible without login Plain text file use.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 75%
Total:403
This week:0
All time:6,543
This week:60Up
User Ratings User Comments (1)
 All time
Utility:100%StarStarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:-
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:67%StarStarStarStar
Rank:443