ajaxCon: Send asynchronous AJAX requests to a server

Recommend this page to a friend!
     
  Info   Example   View files Files   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 216 All time: 228 This week: 2Up
Version License JavaScript version Categories
ajaxcon 1.0Public Domain1.0AJAX, jQuery, Content management
Description 

Author

This object can send asynchronous AJAX requests to a server.

It takes a function name and an array of arguments and sends an AJAX request to the server.

The object parses the server response in JSON format and calls a given callback function for the application to process the response.

Picture of Matthew Knowlton
Name: Matthew Knowlton <contact>
Classes: 1 package by
Country: United States United States
Age: 29
All time rank: 11510 in United States United States
Week rank: 6 Up2 in United States United States Up

Example

<?php require_once('ajaxCon.class.php'); $accountsRegistered = array( 'matthewclemetknowlton@gmail.com', 'test@example.com', 'example@test.com', ); $ajaxCon->addModule('CheckEmail', function($params) use ($accountsRegistered){ $email = strtolower($params['Email']); if(filter_var($email, FILTER_VALIDATE_EMAIL) == false) return array('valid' => false); if(in_array($email, $accountsRegistered)) return array('valid' => true, 'hasAccount' => true); return array('valid' => true, 'hasAccount' => false); }); ?> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="ajaxCon.class.js"></script> <script> $(document).ready(function(){ $('button').click(function(){ Email = $('#Email').val(); ajaxCon.call('CheckEmail', {'Email':Email}, function(r){ if(r.return.valid == false) return $('#EmailStatus').text('Input was not a valid email.'); if(r.return.hasAccount == true) return $('#EmailStatus').text('This email is already registered.'); return $('#EmailStatus').text('Success! The email address is not in our system.'); }); }); }); </script> </head> <body> <p>Email Address Checker Example</p> <input id="Email"/><button>Check</button> <div id="EmailStatus"></div> <br/> <i>Note: test@example.com and example@test.com are already "registered" in the system</i> </body> </html>

  Files folder image Files (3)  
File Role Description
Plain text file ajaxCon.class.js Class JS Class Source
Plain text file ajaxCon.class.php Class PHP Class Source
Accessible without login Plain text file ajaxCon.example.php Example Example Script

 Version Control Unique User Downloads Download Rankings  
 0%
Total:216
This week:0
All time:228
This week:2Up