Small AJAX framework

Posted 2011-04-21

Lately I was in desperate need for small, lightweight, ajax framework. Since I only needed get and post calls, and there wasn't anything small enough to suit my needs - I decided to write something small and handy. iAJAX weights only ~4KB and implements post and get requests. iAJAX can parse:

  • html
  • plain text
  • json
  • xml

 Implementation is quite simple - you only call:

 

iAJAX.iGET = function(url, fn, type, async) { ... }

 

for get request, or: 

 

iAJAX.iPOST = function(url, fn, params, type, async) { ... }

 

for post. Parameters are:

  • url - url to file
  • fn - callback function - function(data){...}
  • params - parameters in form of param1=valu1&m2=value2 or {param1: value1, param2: value2} (only post)
  • async - asynchronous call, should always be true!

To download it, just click here. Code is released under LGPL license.