Sexy.js

A Sequential Ajax (Sajax) JavaScript library for jQuery

API Documentation

Sexy()
  • Sexy
  • Sexy (settings)
  • Sexy.method (arguments)

Creates and optionally configures a new Sexy instance.

Sexy is both a constructor and a factory, eliminating the need for the new keyword. In fact, to simplify syntax even further, each of Sexy's instance methods have been mapped to the Sexy constructor as factories as well.

For details on the settings available for Sexy(), see the documentation for jQuery.ajax.

Sexy.setup()
  • setup (settings)

Set default values for future Ajax requests.

This method is similar to jQuery's native ajaxSetup(), except that the configured settings are applied only to the current Sexy chain.

For details on the settings available for setup(), see the documentation for jQuery.ajax.

Sexy.html()
  • html (url, callback)
  • html (settings)

Returns HTML as plain text. Any included script tags are evaluated when inserted in the DOM.

Sexy.json()
  • json (url, callback)
  • json (settings)

Evaluates the response as JSON and returns a JavaScript object.

Sexy.jsonp()
  • jsonp (url, callback)
  • jsonp (settings)

Loads in a JSON block using JSONP. Will add an extra "?callback=?" to the end of your URL to specify the callback.

Sexy.script()
  • script (url, callback)
  • script (settings)
  • js (url, callback)
  • js (settings)

Evaluates the response as JavaScript, and returns it as plain text. Disables caching unless option "cache" is used. Note: This will turn POSTs into GETs for remote-domain requests.

Sexy.style()
  • style (url, callback)
  • style (settings)
  • css (url, callback)
  • css (settings)

Evaluates the response as CSS and returns it as plain text.

Sexy.text()
  • text (url, callback)
  • text (settings)

A plain text string.

Sexy.xml()
  • xml (url, callback)
  • xml (settings)

Returns a XML document that can be processed via jQuery.

Sexy.bundle()
  • bundle (url1, url2, ..., callback)

Retrieves multiple JavaScripts and evaluates them as a single response. Useful for client-side packaging.