Over a million developers have joined DZone.

Super Lightweight Ajax Function

DZone's Guide to

Super Lightweight Ajax Function

Free Resource
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 http://code.google.com/p/vxjs/


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").

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}