jQuery-ahm: One-Line Ajax Requests

jQuery-ahm is a tiny (~1kb) jQuery plugin which enables us to create Ajax requests with a smaller code piece.

It is actually a wrapper around the popular $.ajax method and brings a different way of handling callbacks.

Rather than creating custom callbacks for every Ajax request, jQuery-ahm lets the back-end define Ajax callbacks (handled automatically).

jQuery-ahm

Here is an example where all the callback is handled on the server-side:

<?php
$response = array(
    // $("#animate").fadeOut("slow").delay("1000").slideDown("fast")
    "#animate/fadeOut"   => "slow",
    "#animate/delay"     => "1000",
    "#animate/slideDown" => "fast",
);
echo json_encode($response);
?>

The bad part is, you move the front-end code and functionality to the server-side. This is not a preferred method for many designers/developers and it is mostly difficult if the front and back-end developers are different persons.

And the nice part is, size of the front-end code can be decreased seriously, specially for websites with lots of Ajax interactions and you get lots of flexibility in managing the callbacks.

Special Downloads:
Ajaxed Add-To-Basket Scenarios With jQuery And PHP
Free Admin Template For Web Applications
jQuery Dynamic Drag’n Drop
ScheduledTweets

Advertisements:
Professional XHTML Admin Template ($15 Discount With The Code: WRD.)
Psd to Xhtml
SSLmatic – Cheap SSL Certificates (from $19.99/year)

Powered by Gewgley