« AJAX Periodic Table of the Elements | Main | AJAX Flickr tag search »

Toxic, AJAX toolkit

I don't know how I've forgot to mention this toolkit here, while it was the first one that I was using, Toxic makes very simple to call PHP methods from javascript. Callbacks can have a "soft" or "hard" binding making it easy to call calbacks in javascript from PHP. Even exceptions thrown in PHP are tranferred and can be caught as normal in javascript. For example

myUser.bindParams('save', 'User_id', 'User_login', 'User_firstname', 'User_lastname', 'User_email', 'User_group', 'User_age'); ... myUser.execute('save'); // The PHP code class User { public function save($id, $login, $firstname, $lastname, $email, $group, $age) { if ($id == null || $id == 0) { // Code to save user return $newUserId; }

throw new Exception("Updating a user is not implemented");
}
}

Toxic license is "free for all purposes except if you try to charge for Toxic itself". You can download Toxic 0.1 AJAX Toolkit from here.

Bookmark this article at these sites
Post a comment





(Email will remain hidden)





Please enter the security code you see here




Related entries
Email to a friend
Email this article to:


Your email address:


Message (optional):