Archives for Friday, June 12th, 2009

You are currently browsing 1 articles posted Friday, June 12th, 2009.

  • 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!

    Be the first to post a comment

Random jQuery Plug-ins

  • Image Zoom

    This plug-in makes links pointing to images open in the "Image Zoom". Clicking a link will zoom out the clicked image to its target-image. Click anywh...

    Details

  • Max Length Form Controls

    Gives form-controls with a 'maxlength-XXX'-class a max-length and prohibits user from entering more than set amount. It also displays number of charac...

    Details

  • Form to Link

    Run this plug-in on a form or an input[type=submit] and it will insert a link after the element you run it on which, on click, will submit said form.

    Details

More Plug-ins

Recent Comments

Powered by Disqus
Page cached. Loaded in: 0.0237 second(s).
Last DB change: 2012-04-02 11:06:05
Last file change: 2012-04-25 20:30:39
Cache created: 2012-05-17 12:11:28