DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

kevin has posted 2 posts at DZone. View Full User Profile

Super Lightweight Ajax Function

  • submit to reddit
        This is part of my super insanely lightweight Javascript framework vX (which is currently 3kb and has many features of the really large frameworks, like animation, ajax, events, and a whole lot more). Learn more about the framework at


use vX(URL[, Callback, Post Parameters]). To simply do an ajax GET request you can do vX(url) if you want to do a simple GET with the second parameter as a  function (or a reference to one) which will be called when the request is completed. The callback will be called with two parameters, the first one with the .responseText attribute of the XHR object, and the second with the actual xhr object. to do a simple POST request you do vX(url, function(){}, "param=blah&etc=cool").