public
Description: Tim's Mini JavaScript Library
Homepage:
Clone URL: git://github.com/seven1m/mini.git
mini /
name age message
file README.textile Loading commit data...
file build.rb
directory doc/
file license.txt
directory pkg/
directory src/
directory test/
README.textile

Tim’s Mini JavaScript Library

github.com/seven1m/mini

Some handy functions for building light Web 5.0 (beta of course) applications.

mini.ajax

mini.form.serialize(f)
Serializes all the fields in a form so that they can be passed as a query string in the form “arg1=val1&arg2=val2”.

mini.ajax.x()
The XMLHttpRequest object (or MS equivalent) used for communication

mini.ajax.send(u,f,m,a)
Send a basic Ajax request.

mini.ajax.get(url,func)
Uses a GET request to query the specified url and return a response to the specified function.

mini.ajax.gets(url)
Uses a GET request to query the specified url and return a response synchronously. Use this sparingly, as synchronous calls can lock up the browser.

mini.ajax.post(url,func,args)
Uses a POST request to query the specified url and return a response to the specified function.

mini.ajax.update(url,elm,method,args)
Uses a POST request to query the specified url and insert the result into the specified element.

  • method = GET or POST (default)
  • args = arguments as string (not used if specifying GET — instead pass args with url like this: “url?arg=val”)

mini.ajax.submit(url,frm,elm)
Used in the onsubmit handler of a function. The form is not submitted the usual way; the form is instead serialized using “ajax.serialize” and submitted using “ajax.post”. The result is then inserted into the specified element.

  • frm = form element
  • elm (optional) = element to update with returned content; if blank, returned content will be assumed to be javascript, and will be evaluated
    Example: <form action="fallback/url" onsubmit="mini.ajax.submit('ajax/form/url', this, 'div_to_update')