github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

seven1m / mini

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 6
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • master ✓
    • needswork
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Tim's Mini JavaScript Library — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Clean up ajax.serialize 
seven1m (author)
Sun Dec 21 20:02:38 -0800 2008
commit  9538f8778780bfac6636ebfc87442676991b56d6
tree    8aa31aaf4588f1afdd5c63da0d4f0f7a94483e56
parent  a37869b49dfb7022f8f4d16955d8a48d3714ecf1
mini /
name age
history
message
file README.textile Sun Dec 21 19:52:53 -0800 2008 More readme goodness. [seven1m]
file build.rb Sat Dec 20 23:27:00 -0800 2008 Add some usage instructions to the readme. [seven1m]
file license.txt Thu Dec 18 19:47:12 -0800 2008 initial import - mini.ajax only [seven1m]
directory pkg/ Sun Dec 21 20:02:38 -0800 2008 Clean up ajax.serialize [seven1m]
directory src/ Sun Dec 21 20:02:38 -0800 2008 Clean up ajax.serialize [seven1m]
directory test/ Sun Dec 21 20:02:38 -0800 2008 Clean up ajax.serialize [seven1m]
README.textile

Tim’s Mini JavaScript Library

github.com/seven1m/mini

An uber lightweight library for building buzzword-compliant beta Web 5.0 applications.

Usage

  1. Download and stick the contents of pkg/ in your app’s javascript directory (the files in src/ contain comments and a bit of whitespace, whereas pkg/ contains minified versions).
  2. Depending on your needs, add one or more <script> tags, e.g. <script type="text/javascript" src="/js/ajax.js"></script>, to your html.

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');return false;">

mini.form

mini.form.validate(frm)
Use in the onsubmit handler of your form to validate that required fields are completed, e.g. <form onsubmit="return mini.form.validate(this)">
Indicate required fields with class=“required”
Add label.error { color: red; } or similar to your stylesheet so that errored fields will stand out.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server