SourceForge.net Logo

Using the JavaScript Client API

Like all Ajax operations, using Taconite consists of three parts: Making a call to the server from browser-side JavaScript, returning some sort of response from the server to the client, and then doing something with that response back in the browser using JavaScript. This section focuses on the first part, making a call to the server from client-side JavaScript.

The Taconite jQuery plugin provides some convenient helper functions to make issuing the Ajax calls from the browser very easy. jQuery provides three commonly used functions:

  1. $.get()
  2. $.post()
  3. $.ajax()

The Taconite jQuery parser provides three similar functions that automatically use Taconite to consume the server's XML response:

  1. $.taconiteGet(url, [data])
  2. $.taconitePost(url, [data])
  3. $.taconiteAjax(settings)

#1 and #2 are identical to the jQuery $.get and $.post functions, respectively, with the only difference being that the third argument (the success callback) is not necessary, as these functions automatically delegate to Taconite. Both of these functions append a query parameter named _ts with a random numeric value to avoid any caching issues.

#3 is identical to jQuery's $.ajax() function. The only difference is that #3 tweaks the "settings" parameter to use Taconite for the success callback, and specify that the server's response type is xml. Additionally, the "cache" property of the settings parameter is set to false to avoid any caching problems.