Articles Tagged with "ajax"
You are currently browsing 1 articles tagged with "ajax".
Super Simple Ajax (Without a Framework)
Published Friday 12th of June 2009
If you're looking for the bare minimum when it comes to doing cross-browser GET or POST XHR then this might be the script for you.
I know there's hundreds (probably thousands) of these scripts out there already but even the most lightweight ones I could find seemed kind of bloated.
Example
// GET latest-comments.php and update the #latest-comments element
superSimpleAjax({url: 'latest-comments.php'}, 'latest-comments');
// GET article with ID 12 and alert its contents
superSimpleAjax({
url: 'get-article.php',
data: 'id=12',
callback: function (data) {
alert(data);
}
});
// POST a comment to post-comment.php
superSimpleAjax({
method: 'POST',
url: 'post-comment.php',
data: 'author=John Doe&email=johndoe@johndoe.com&content=Hi, my name is John Doe',
callback: function (data) {
alert('Thanks for your comment!');
}
});Grab the code from Google Code. It's about 1k uncompressed.
Enjoy!
Join 2 others and post a comment
Random jQuery Plug-ins
Code Block Toolbar
If you post code-examples on your site you can use this plug-in to add some nifty buttons below each code-example that allows the user to, for example...
Togglable DL
Use this plug-in on your definition-lists (dl-elements) to allow the dd:s for a dt to be toggled when clicking the dt. Don't use it unless it's semant...
Center
This little pluggy centers an element on the screen using either fixed or absolute positioning. Can be used to display messages, pop up images etc.