Active Name Version Description
Android An Open Handset Alliance Project
Axis2 1.3
CakePHP 1.2 Rapid Development Php Framework
CSS
Grails 1.x Groovy version of Ruby on Rails
Groovy 1.6 Object-oriented language alternative for Java platform
Hibernate v3 High performance object/relational persistence and query service
HTML 4.x
Java 6 6
Java EE 5 5
Javascript Javascript functions, classes, event handlers
jQuery The Write Less, Do More, JavaScript Library
JSON Java JSON in Java from json.org
MySQL
Perl 5.10.0
PHP 5.x
Prototype A widely used JavaScript Framework
Python 2.5
Python C 2.5
Python Lib 2.5
Rails 2.3.5 A framework for developing web applications according to MVC
Ruby 1.8.7 A dynamic, interpreted, open source programming language
SiteMesh
Spring Framework 2.5 Full-stack Java/JEE application framework
Struts 2 2.0.11.2
Trails Core 1.2.1 Domain driven development framework in the spirit of Ruby on Rails
Trails Hibernate 1.2.1
Trails Security 1.2.1
Trails Test 1.2.1
Xerces2 J 2.9.1
Quick search is faster, or start browsing by clicking on API title
    Ajax.Ajax Options - Prototype JavaScript framework

    Ajax Options

    This details all core options (shared by all AJAX requesters) and callbacks.

    All requester object in the Ajax namespace share a common set of options and callbacks. Callbacks are called at various points in the life-cycle of a request, and always feature the same list of arguments. They are passed to requesters right along with their other options.

    Common options

    Option Default Description
    asynchronous true Determines whether XMLHttpRequest is used asynchronously or not. Since synchronous usage is rather unsettling, and usually bad taste, you should avoid changing this. Seriously.
    contentType 'application/x-www-form-urlencoded' The Content-Type header for your request. You might want to send XML instead of the regular URL-encoded format, in which case you would have to change this.
    encoding 'UTF-8' The encoding for your request contents. It is best left as is, but should weird encoding issues arise, you may have to tweak it in accordance with other encoding-related parts of your page code and server side.
    method 'post' The HTTP method to use for the request. The other widespread possibility is 'get'. As a Ruby On Rails special, Prototype also reacts to other verbs (such as 'put' and 'delete' by actually using 'post' and putting an extra '_method' parameter with the originally requested method in there.
    parameters '' The parameters for the request, which will be encoded into the URL for a 'get' method, or into the request body for the other methods. This can be provided either as a URL-encoded string or as any Hash-compatible object (basically anything), with properties representing parameters.
    postBody None Specific contents for the request body on a 'post' method (actual method, after possible conversion as described in the method opt ion above). If it is not provided, the contents of the parameters option will be used instead.
    requestHeaders See text

    Request headers can be passed under two forms:

    • As an object, with properties representing headers.
    • As an array, with even-index (0, 2…) elements being header names, and odd-index (1, 3…) elements being values.

    Prototype automatically provides a set of default headers, that this option can override and augment:

    • X-Requested-With is set to 'XMLHttpRequest'.
    • X-Prototype-Version provides Prototype's current version (e.g. 1.5.0).
    • Accept defaults to 'text/javascript, text/html, application/xml, text/xml, */*'
    • Content-type is built based on the contentType and encoding options.
    evalJS true Automatically evals the content of Ajax.Response#responseText if the content-type returned by the server is one of the following: application/ecmascript, application/javascript, application/x-ecmascript, application/x-javascript, text/ecmascript, text/javascript, text/x-ecmascript, or text/x-javascript and the request obeys SOP. If you need to force evalutation, pass 'force'. To prevent it altogether, pass false.
    evalJSON true Automatically evals the content of Ajax.Response#responseText and populates Ajax.Response#responseJSON with it if the content-type returned by the server is set to application/json. If the request doesn't obey SOP, the content is sanitized before evaluation. If you need to force evalutation, pass 'force'. To prevent it altogether, pass false.
    sanitizeJSON false for local requests, true otherwise. Sanitizes the content of Ajax.Response#responseText before evaluating it.

    Common callbacks

    When used on individual instances, all callbacks (except onException) are invoked with two parameters: the XMLHttpRequest object and the result of evaluating the X-JSON response header, if any (can be null).

    For another way of describing their chronological order and which callbacks are mutually exclusive, see Ajax.Request.

    Callback Description
    onCreate
    (v1.5.1)
    Triggered when the Ajax.Request object is initialized. This is after the parameters and the URL have been processed, but before first using the methods of the XHR object.
    onComplete Triggered at the very end of a request's life-cycle, once the request completed, status-specific callbacks were called, and possible automatic behaviors were processed.
    onException Triggered whenever an XHR error arises. Has a custom signature: the first argument is the requester (i.e. an Ajax.Request instance), the second is the exception object.
    onFailure Invoked when a request completes and its status code exists but is not in the 2xy family. This is skipped if a code-specific callback is defined, and happens before onComplete.
    onInteractive (Not guaranteed) Triggered whenever the requester receives a part of the response (but not the final part), should it be sent in several packets.
    onLoaded (Not guaranteed) Triggered once the underlying XHR object is setup, the connection open, and ready to send its actual request.
    onLoading (Not guaranteed) Triggered when the underlying XHR object is being setup, and its connection opened.
    onSuccess Invoked when a request completes and its status code is undefined or belongs in the 2xy family. This is skipped if a code-specific callback is defined, and happens before onComplete.
    onUninitialized (Not guaranteed) Invoked when the XHR object was just created.
    onXYZ With XYZ being an HTTP status code for the response. Invoked when the response just completed, and the status code is exactly the one we used in t he callback name. Prevents execution of onSuccess / onFailure. Happens before onComplete.

    Responder callbacks

    When used on responders, all callbacks (except onException and onCreate) are invoked with three parameters: the requester (i.e. the corresponding "instance" of Ajax.Request) object, the XMLHttpRequest object and the result of evaluating the X-JSON response header, if any (can be null). They also execute in the context of the responder, bound to the this reference.

    Callback Description
    onCreate Triggered whenever a requester object from the Ajax namespace is created, after its parameters where adjusted and its before its XHR connection is opened. This takes two arguments: the requester object and the underlying XHR object.
    onComplete Triggered at the very end of a request's life-cycle, once the request completed, status-specific callbacks were called, and possible automatic behaviors were processed.
    onException Triggered whenever an XHR error arises. Has a custom signature: the first argument is the requester (i.e. an Ajax.Request instance), the second is the exception object.
    onInteractive (Not guaranteed) Triggered whenever the requester receives a part of the response (but not the final part), should it be sent in several packets.
    onLoaded (Not guaranteed) Triggered once the underlying XHR object is setup, the connection open, and ready to send its actual request.
    onLoading (Not guaranteed) Triggered when the underlying XHR object is being setup, and its connection opened.
    onUninitialized (Not guaranteed) Invoked when the XHR object was just created.