My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Options  

Featured
Updated Dec 7, 2009 by dom111@gmail.com

Options

The various options for ajaxify:

append

String. Appends the specified string to the end of the URL, useful for handling the page differently (stripping header and footer).

Deafult: 'ajax=1'

buttons

String. The jQuery selector used to find the submission methods.

Default: 'button[type=submit], input[type=submit], input[type=image]'

confirm

Mixed. If set to a string, will be displayed in a confirm() box before proceeding with the request. If set to any non-true value, will proceed normally.

Default: null

replace

Boolean. If set to true, will replace() content in the update element, otherwise will just append().

Default: true

submit

Object. Various events to be carried out onsubmit.

disable

Object. Disable certain elements (form only)

selector

String. If set, will disable all elements within the parent element that match the selector, if set to the string 'buttons' will use the same selector as the buttons option, if set to any non-true value, no elements will be disabled.

Default: null

className

String. If set to a non-empty string, will apply the specified class to the elements specified by the selector option.

Default: null

message

Object. Display a message when the onsubmit event is fired.

text

String. If set to a non-empty string, will apply display the string as a message on the screen. Note: currently this message is appended to the <body/> in a <div/> that is given the id ajaxify__submitMessage__

Default: null

className

String. If set to a non-empty string, the specified class is applied to the message box.

Default: null

waiting

Object. If nothing has happened after waiting.timeout * 1000ms, update the message (if set) and re-enable the buttons (if disabled).

timeout

Number. The duration (in seconds) to wait before un-doing the submission events. If set to any non-true value, this will not run.

Default: 0

message

String. The updated message. If set to a non-true value, the message will not be changed.

Default: null

className

String. An updated class to apply to the message box.

Default: null

callback

Function. A callback run when the timeout is reached.

Default: null

update

Mixed. The element to populate with the returned data, or a selector for the specified element. If this is set to a non-true value, the container element will be checked for a target attribute, if this is found it will be used, if it's not found, the container's parent node will be used.

Default: null

jQuery AJAX object options

You can also pass options for the jQuery AJAX object to the ajaxify() method. See http://docs.jquery.com/Ajax/jQuery.ajax#toptions.

async

Default: true

beforeSend

Default: null

complete

Default: null

contentType

String. If set to a non-true value, the enctype attribute will be checked (<form/>) or 'application/x-www-form-urlencoded' will be used (<a/> or no enctype attribute set).

Default: null

dataFilter

Default: null

dataType

Default: 'html'

error

Default:

    function(XHR, textStatus, errorThrown) {
      // to access the options you can use var options = this; or see the success function for alternative is this changes in future
      if ('console' in window) {
        if ('warn' in window.console) {
          console.warn('Error processing data via AJAX:\n' + errorThrown + ' (' + textStatus + ')');

        } else if ('log' in window.console) {
          console.log('Warning: Error processing data via AJAX:\n' + errorThrown + ' (' + textStatus + ')');
        }

      } else {
        alert('Error processing data via AJAX:\n' + errorThrown + ' (' + textStatus + ')');
      }
    }

success

Default:

    function(data, textStatus) {
      // this refers to this options object, when I assumed it would refer to the AJAX object, will this change in future versions?
      var options = this;
      // if it does change in the future, then this snippet should help:
      // if (this.id) {
      //   var options = Ajaxify.retrieve(this.id).options;
      // }

      if (options.replace) {
        jQuery(options.update).html(data);

      } else {
        jQuery(options.update).append(data);
      }
    }

type

String. If set to a non-true value, the container element will be checked for a method attribute (<form/>) or will be set to 'GET' (<a/>).

Default: null

url

String. If set to a non-true value, the container element will be checked for an action attribute (<form/>) or an href attribute (<a/>) and this will be used.

Default: null


Sign in to add a comment
Powered by Google Project Hosting