Skip to content
Wai Ho Leung edited this page Apr 10, 2014 · 5 revisions

WikiAPI ReferenceAjax

# ajax.get(url, func[, err])

Loads data from the server using a HTTP GET request.

  • url: A string containing the URL to which the request is sent.
  • func: A callback function that is executed if the request succeeds.
  • err: A callback function that is executed if the request fails.

===

# ajax.gets(url)

Loads data from the server using a HTTP GET request and returns the response text.

  • url: A string containing the URL to which the request is sent.

===

# ajax.post(url, func, args[, err])

Loads data from the server using a HTTP POST request.

  • url: A string containing the URL to which the request is sent.
  • func: A callback function that is executed if the request succeeds.
  • args: Data to be sent to the server.
  • err: A callback function that is executed if the request fails.

===

# ajax.send(url, func, method, args[, err])

Perform an asynchronous HTTP (Ajax) request.

  • url: A string containing the URL to which the request is sent.
  • func: A callback function that is executed if the request succeeds.
  • method: The type of request to make ("POST" or "GET").
  • args: Data to be sent to the server.
  • err: A callback function that is executed if the request fails.

===

# ajax.serialize(f)

Encodes a set of form elements as a string for submission.

  • f: The form element to be serialized.

===

# ajax.submit(url, elm, frm)

Serializes a form, loads data from the server using a HTTP POST request, and replaces the content of the element with the data.

  • url: A string containing the URL to which the request is sent.
  • elm: An element which will contain the response from the server.
  • frm: The form element to be serialized.

===

# ajax.update(url, elm)

Loads data from the server using a HTTP GET request and replaces the content of the element with the data.

  • url: A string containing the URL to which the request is sent.
  • elm: An element which will contain the response from the server.

===

# ajax.x()

Returns a browser-dependent Ajax object.

Clone this wiki locally