jQuery Library

revIgniter's jQuery Library lets you write jQuery code for event handling, animation and Ajax interactions using LiveCode. If you intend to build complex jQuery driven sites you may prefer to stick to JavaSript and the jQuery syntax. But if you just need simple Ajax functionality this library provides a convenient way to, even dynamically, build jQuery code without dirtying your hands with JavaScript, though you still have to make yourself familiar with jQuery to some degree. The Jquery version currently supported is 1.4.2.

 

Overview

Before explaining revIgniter's approach to jQuery, let's describe how to embed jQuery code in your view file and how this code is built.

  1. First, you need to define, where jQuery is located. You may include the framework remotely without storing any copy on your host.
  2. Then you tell the library to start writing the jQuery script.
  3. Now you can choose from a variety of functions to build all sorts of Ajax interaction.
  4. Finally you tell the library to return the complete script, so that you can store it in the gData variable to be merged with the view.

Initializing the Library

Like most other libraries in revIgniter, the Jquery library is initialized in your controller using the rigLoaderLoadLibrary handler:

rigLoaderLoadLibrary "Jquery"

Setting preferences

There are three preferences you can set by passing an array in the second parameter of the loading handler. The example below tells the library to use a copy of the jQuery framework called "jquery.js" located at assets/js/:

put FALSE into tJquerySettings["useJQremotely"]
rigLoaderLoadLibrary "Jquery", tJquerySettings

To specify a different path to jQuery your code should look like this:

put "your/path/to/jquery/jquery.js" into tJquerySettings["jqueryPath"]
rigLoaderLoadLibrary "Jquery", tJquerySettings

If you specify a jQuery version number like in the following example, the framework will be loaded from googleapis.com. For speed reasons this is the preferred method:

put "1.4.2" into tJquerySettings["jqueryCurrentVersion"]
rigLoaderLoadLibrary "Jquery", tJquerySettings

Note: If you don't set any preferences the latest version of jQuery, located at jquery.com, will be used.

 

Tutorial: revIgniter's Approach to jQuery

What follows is a tutorial based on the "Ajax Integration" example published by Runtime Revolution Ltd. at the on-rev samples site. It demonstrates how to filter data using text the user types into a form field. Contrary to the on-rev sample you won't write any jQuery / JavaScript code. Now let's see, what you will need:

  1. A database table named "people".
  2. A controller to receive and process the data submitted by the jQuery script, which processes the user's keystrokes.
  3. A view file containing an input form field and a table.
  4. A view file, which is used to dynamically replace the table data in the view file, mentioned above.
  5. A very simple model, which gets data from your database table.

To begin, build the table using the table structure below and insert the corresponding data. We use MySQL here as database platform.

CREATE TABLE IF NOT EXISTS `people` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `name` varchar(64) default NULL,
  `age` int(2) default NULL,
  `email` varchar(64) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

INSERT INTO `people` (`id`, `name`, `age`, `email`) VALUES
(1, 'Ben Montini', 27, 'ben@montini.com'),
(2, 'James Johnson', 31, 'james@thejohnsons.com'),
(3, 'Michael Jordan', 52, 'michael@basketballstars.com'),
(4, 'Theresa May', 57, 'ex-priminister@theuk.com'),
(5, 'Jonathan Edwards', 44, 'triple@jump.com'),
(6, 'Tim Cook', 52, 'tim@apple.com'),
(7, 'Bill Gates', 55, 'bill@microsoft.com'),
(8, 'Big Bird', 34, 'bigbird@thestreet.com'),
(9, 'Ben Saim', 22, 'ben.saim@saim.com'),
(10, 'Donald Trump', 49, 'trump@theusa.com'),
(11, 'David Brent', 54, 'david@funny.com'),
(12, 'Graeme Gooch', 66, 'bat@thecricketball.com'),
(13, 'Steven Spielberg', 64, 'me@moviemaking.com'),
(14, 'Ralf Bitter', 99, 'rabit@revigniter.com');

Now let's create the irev files.

Controller

We start with the basic prototype for a controller script. Create a controller called ajax.lc. In it, place the code below and save it to your application/controllers/ folder. Of course, you may remove the comments.

<?lc

# PUT YOUR HANDLER NAMES  INTO THE GLOBAL gControllerHandlers AS A COMMA SEPARATED LIST
put "ajax,index" into gControllerHandlers


# THE CONTROLLER HANDLER
command ajax
  # LOAD REQUIRED LIBRAIES, MODELS, HELPERS ETC.
end ajax

# THE DEFAULT HANDLER
command index
  -- do something here
end index



--| END OF ajax.lc
--| Location: ./application/controllers/ajax.lc
----------------------------------------------------------------------

Now, to load required libraries, helpers and models, insert this code into the ajax handler.
First, we load the "Jquery" library. If you don't change the default setting using the second parameter, your code will link to the latest version of jQuery on jquery.com and you don't need to store a copy of jQuery on your host, though, as mentioned above, this is not recommended in a runtime environment.
We load the Table library as we want to display the data in the form of a table.
Of course, we load the database and we need a model, which we call "ajaxmodel".

rigLoaderLoadLibrary "Jquery"
rigLoaderLoadLibrary "Table"
get rigLoadDatabase()
rigLoadModel "ajaxmodel"

 

Let's build the index handler. Insert the following statement, which stores the page title in gData.

put "revIgniter Ajax Tutorial" into gData["pageTitle"]

Now to the important part, the statements, which build the jQuery script. We want the script to handle key-up events in the input field. It should post the text, the user has typed, and replace HTML code with data returned by the controller.
Add this statement to tell the jQuery library to start writing the jQuery script:

rigJQopen

Add this statement to tell the library to start writing an event function, which is triggered by key-up events in an input field with the id named "filter".

rigJQeventOpen "'#filter'", "'keyup'"

Add the following statement, which posts the text (value) of the input field as "search_term" to the controller and it's datafilter handler, and replaces the HTML code inside the "#results" div with the returned data. Note: Here we use a getter, which returns the jQuery syntax to get the value of the input field.

rigJQxhRequest "load", "ajax/datafilter", "search_term:" && rigJQgetR("'#filter'", "attr", "'value'"), , , "'#results'"

Tell the library to end writing the event function by adding this statement:

rigJQeventClose

Add this statement to close the jQuery script:

rigJQclose

To store the script in the gData variable add the following line:

put the result into gData["JQscript"]

The next statement calls the model function to retrieve the data from the database:

put peopleData() into tQuery

To build the HTML table add this statement:

buildTable tQuery

Finally load the view file, which we call "ajaxView":

get rigLoadView("ajaxView")

We need two handlers more. One, which retrieves the filtered data from the model, and one which stores the corresponding HTML table in the gData variable.

Insert the code below right after the index handler.This handler is called by the jQuery script. It checks if there is POST data, that is to say if key "search_term" has a value. Then it gets the filtered data from the model, calls the buildTable controller handler if the query returned data, and finally loads the view "filteredView".

command datafilter
  put rigVarPost("search_term", TRUE) into tSearchTerm
  if (tSearchTerm <> FALSE) then
    put peopleData(tSearchTerm) into tQueryResult
  end if
  if tQueryResult <> FALSE then
    buildTable tQueryResult
  else
    put "No match!" into gData["peopleTable"]
  end if
  get rigLoadView("filteredView")
end datafilter

Note: revIgniter comes with a Cross Site Scripting Hack prevention filter which can either run automatically to filter all POST and COOKIE data that is encountered, or you can run it on a per item basis. In this case the filter is called by setting the second parameter of rigVarPost() to "TRUE".

Note: Don't forget to add the handler name "datafilter" to the global variable gControllerHandlers at the top of the page.

Insert the handler, which stores the HTML table code in the gData variable by processing the database data, after the datafilter handler to complete the controller.

command buildTable pQueryResult
  put pQueryResult["resultarray"] into tResult
  rigSetTableHeading pQueryResult["fieldnames"], TRUE
  put rigGenerateTable(tResult) into gData["peopleTable"]
end buildTable

Note: Don't forget to add the handler name "buildTable" to the global variable gControllerHandlers at the top of the page.

The code of your controller should now look like this:

<?lc

put "ajax,index,datafilter,buildTable" into gControllerHandlers

command ajax
  rigLoaderLoadLibrary "Jquery"
  rigLoaderLoadLibrary "Table"
  get rigLoadDatabase()
  rigLoadModel "ajaxmodel"
end ajax

command index
  put "revIgniter Ajax Tutorial" into gData["pageTitle"]
  rigJQopen
    rigJQeventOpen "'#filter'", "'keyup'"
      rigJQxhRequest "load", "ajax/datafilter", "search_term:" && rigJQgetR("'#filter'", "attr", "'value'"), , , "'#results'"
    rigJQeventClose
  rigJQclose
  put the result into gData["JQscript"]
  put peopleData() into tQuery
  buildTable tQuery
  get rigLoadView("ajaxView")
end index

command datafilter
  put rigVarPost("search_term", TRUE) into tSearchTerm
  if (tSearchTerm <> FALSE) then
    put peopleData(tSearchTerm) into tQueryResult
  end if
  if tQueryResult <> FALSE then
    buildTable tQueryResult
  else
    put "No match!" into gData["peopleTable"]
  end if
  get rigLoadView("filteredView")
end datafilter

command buildTable pQueryResult
  put pQueryResult["resultarray"] into tResult
  rigSetTableHeading pQueryResult["fieldnames"], TRUE
  put rigGenerateTable(tResult) into gData["peopleTable"]
end buildTable



--| END OF ajax.lc
--| Location: ./application/controllers/ajax.lc
----------------------------------------------------------------------

View "ajaxView"

Create a view called ajaxView.lc. In it, place this code and save it to your application/views/ folder:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <title>[[gData["pageTitle"]]]</title>

    <? return rigJQuerySource() ?>

    [[gData["JQscript"]]]

    </head>

    <body>
      <div class="page_margins">
        <div id="content">
          <div id="input">Name: <input name="name" type="text" id="filter" /></div>
          <p>&nbsp;</p>
          <h2>Dynamic Result (pulled from database)</h2>
          <div id="results">[[gData["peopleTable"]]]</div>
        </div>
      </div>
    </body>
</html>

Note: rigJQuerySource() is a Jquery library function, which returns a html string linking to jQuery.

View "filteredView"

Create the view called filteredView.lc, which is loaded by the datafilter handler. In it, place just this expression and save it to your application/views/ folder:

[[gData["peopleTable"]]]

Model

There is only one model function needed. This function retrieves the filtered data from the database. Create this model called ajaxmodel.lc. In it, place the following code and save it to your application/models/ folder:

<?lc

function peopleData pSearchTerm
  if pSearchTerm <> "" then
    rigDbLike "name", pSearchTerm
  end if
  put rigDbGet("people") into tQueryResult
  if tQueryResult["numrows"] > 0 then
    return tQueryResult
  end if
  return FALSE
end peopleData

That's it, filtering the list should work as expected.

 

Basic Principles

There is a set of rules you should keep in mind:

 

Handler Reference

The following handlers are intended for use in your controller handlers. There are some highly specialized handlers like rigJQajaxForm, rigJQeventAlert, rigJQeventEffect, rigJQeventAnim, rigJQconfirm or rigJQprompt, and others like rigJQset, rigJQgetR or rigJQeventOpen, which are more generic ones.

rigJQuerySource()

This function returns the html string linking to jQuery.

rigJQopen

Use this handler to tell the library to start building your jQuery script.

rigJQclose

Ends building your script and returns it. Example:

rigJQclose
put the result into gData["JQscript"]

rigJQajaxForm submitBtnSelector, selectorList, postURI, preventDefault, dataToLoadURI, dataContainerSelector

Permits you to process form data using a xmlHTTPrequest and place the returned HTML into the matched element. Example:

rigJQajaxForm "'#submitBtn'", "'#formField'", "'myController/addDataHandler'", TRUE, "'myController/viewHandler'", "'#content'"

The first parameter is a selector tied to the form submit button. The second parameter is a comma delimited list of selectors of form elements. The third parameter specifies the URI to post the data to. The optional fourth parameter is a boolean used to prevent the default action of the event to be triggered, default is TRUE. The optional fifth parameter specifies the URI, which is responsibel for loading a view containing result data. The optional sixth parameter specifies the selector of an object, which acts as a container for the result data returned by the controller.

Note: This handler assumes, that IDs and names of form elements are identical.

rigJQeventAlert selector, event, alert, preventDefault, eventData

Displays an alert on various events. Example:

rigJQeventAlert "a", "click", "'As you can see, this link no longer takes you to revIgniter.com'", TRUE

The first parameter specifies a selector, the second an event type. Third parameter determines the alert to be displayed. This can be a string or the eventData parameter of the event object. This data can be passed to jQuery with the fifth parameter. The optional fourth parameter is a boolean used to prevent the default action of the event to be triggered if set to TRUE.

Here is another example showing how to use the optional fifth parameter:

rigJQvar "message,'This is an alert.'"
rigJQeventAlert "'#testObject'", "'click'", "event.data.msg", , "msg: message"

Note: This handler assumes an event object named "event". Mind the syntax of the Key/Value pair, a map (JavaScript object), contained in the fifth parameter.

For more event types see the jQuery documentation.

rigJQalert alert

This handler writes a simple alert statement. The parameter is a string to be displayed as alert.

rigJQalertR(alert)

This function does the same as it's equivalent handler (JQalert), but instead of adding the statement to the script, it returns it.

rigJQconfirm varName, question, global

Adds a statement, which displays a JavaScript confirmation box and stores the returned value in a variable. The first parameter is the name of the variable. The second parameter is the question to be asked and the third parameter is a boolean, which specifies if it is a global variable.

rigJQconfirmR(varName, question, global)

This function does the same as it's equivalent handler (JQconfirm), but instead of adding the statement to the script, it returns it.

rigJQprompt varName, prompt, default, global

Adds a statement, which displays a JavaScript prompt box and stores the input value in a variable. The first parameter is the name of the variable. The second parameter is the prompt. The optional third parameter is the default value and the optional fourth parameter is a boolean, which specifies if the variable, the input value is stored in, should be global.

rigJQpromptR(varName, prompt, default, global)

This function does the same as it's equivalent handler (JQprompt), but instead of adding the statement to the script, it returns it.

rigJQset selector, method, propertyValues, function, ToggleClassSwitch

Permits you to write all sorts of jQuery setter statements, which manipulate the DOM in some manner. Example:

rigJQset "'p:last'", "addClass", "'selected'"

The first parameter specifies a selector, the second a jQuery method. The third parameter contains the values to be set. Depending on the specified method, these can be a string, an array, a comma delimited list or a function returning the content to set. The optional fourth parameter, a boolean, tells the handler to treat the Propertyvalues parameter as function. The optional fifth parameter is only used by the toggleClass method. It is a boolean to determine whether the class should be added or removed.

Here is another example, which shows the use of a function as property value:

put "return 'selected';" into tSetterData
rigJQset "'p:last'", "addClass", tSetterData, TRUE

Note: To reference the function arguments for index positions of elements in a set and for old values, always use the terms "index" and "oldVal".

rigJQsetR(selector, method, propertyValues, function, ToggleClassSwitch)

This function does the same as it's equivalent handler (JQset), but instead of adding the statement to the script, it returns it.

rigJQgetR(selector, method, getterProp)

Permits you to retrieve information from DOM elements for later use. Example:

rigJQgetR("'#userinput'", "attr", "'value'")

The first parameter specifies a selector, the second a jQuery method. Use the optional third parameter to determine the property to get.

rigJQeventOpen selector, event, preventDefault, eventData, eventObject, FunctionArguments

This tells the library to start writing statements registering behaviors to take effect when the user interacts with the browser. Example:

rigJQeventOpen "'#logout'", "'click'"
  rigJQvar "logout,confirm('Are you sure you want to end the chat session?');"
  rigJQcondition "logout==true", "window.location = 'logout';"
rigJQeventClose

The first parameter specifies a selector, the second a JavaScript event. The optional third parameter is a boolean used to prevent the default action of the event to be triggered, default is TRUE. The optional fourth parameter contains data passed to the function. The optional fifth parameter is a function to execute each time the event is triggered. The optional sixth parameter contains additional function arguments.

Here is another example demonstrating the use of additional function arguments:

rigJQeventOpen "'#customObject'", "'myCustomEvent'", , , , "myName, myValue"
  rigJQset "this", "text", "myName + ', hi there!'"
rigJQeventClose

rigJQeventOpen "'#clickObject'", "'click'"
  rigJQeventOpen "'#customObject'", "'trigger'", , "'myCustomEvent','John','TestValue'"
  rigJQeventClose
rigJQeventClose

Note: Don't use "bind" as event in a rigJQeventOpen handler. jQuery event objects need to be referenced as "event".

rigJQeventClose

Used to mark the end of the event function.

rigJQeventEffect triggerSelector, targetSelector, event, effect, parameter, preventDefault, callback

Permits you to set special effects on various events. Example:

rigJQeventEffect "'#hideBtn'", "'#hideDiv'", "'click'", "hide", "'slow'", , rigJQeffectR("'a'", "hide")

The first parameter specifies an object, which triggers the event, the second determines the object the effect is applied to. The third parameter is an event type. The fourth parameter specifies an effect method. The optional fifth parameter is used to set effect parameters. The optional sixth parameter is a boolean used to prevent the default action of the event to be triggered, default is TRUE. The optional seventh parameter contains a function to call once the animation is complete.

Here is another example:

put rigJQeffectR("'a'", "show") & return & rigJQalertR("'This is an alert!'") into tCallbackShow
rigJQeventEffect "'#showBtn'", "'#showDiv'", "'click'", "slideDown", "'slow'", , tCallbackShow

rigJQeffect selector, effect, duration, callback

Permits you to apply effects to objects. Example:

rigJQeffect "'a'", "hide", "'slow'"

The first parameter determines the object the effect is applied to. The second specifies the effect. The optional third parameter is used to set the effect duration and the optional fourth parameter contains a function to call once the animation is complete.

Note: Don't use "animate" as effect. There is a special rigJQanimate handler for this type of effect.

rigJQeffectR(selector, effect, effectData, callback)

This function does the same as it's equivalent handler (JQeffect), but instead of adding the statement to the script, it returns it.

rigJQeventAnim triggerSelector, targetSelector, event, properties, Duration, Easing, Callback

Permits you to perform a custom animation of a set of CSS properties on various events. Example:

put "'20%'" into tAnimProps["width"]
put "0.4" into tAnimProps["opacity"]
put "'0.6in'" into tAnimProps["marginLeft"]
put "'3em'" into tAnimProps["fontSize"]
put "'10px'" into tAnimProps["borderWidth"]
rigJQeventAnim "'#go'", "'#block'", "click", tAnimProps, "1500"

The first parameter specifies an object, which triggers the event, the second determines the object the animation is applied to. The third parameter specifies the event and the fourth the CSS properties to be animated. Put these into an array. The optional fifth parameter sets the animation duration, this can be an integer, a string or an array. The optional sixth parameter contains a string indicating which easing function to use for the animation. The optional seventh parameter contains a function to call once the animation is complete.

Note: Use an array for duration if you need to set more properties than the duration only. To provide other easing functions than the default "swing" for animation you need additional Jquery plugins.

rigJQanimate selector, properties, duration, easing, callback

Permits you to perform a custom animation of a set of CSS properties.

The first parameter determines the object the animation is applied to. The second parameter contains the CSS properties to be animated. This can be an array or a string. If you don't use an array use the following form: "key1: value1, key2: value2, . . ." The optional third parameter sets the animation duration, this can be an integer, a string or an array. The optional fourth parameter contains a string indicating which easing function to use for the animation. The optional fifth parameter contains a function to call once the animation is complete.

rigJQanimateR(selector, properties, duration, easing, callback)

This function does the same as it's equivalent handler (JQanimate), but instead of adding the statement to the script, it returns it.

Note: Use an array for duration if you need to set more properties than the duration only. To provide other easing functions than the default "swing" for animation you need additional Jquery plugins.

rigJQajax ajaxOptions, setUpOnly

Permits you to perform an asynchronous HTTP (Ajax) request. Example:

put "ajax/datafilter" into tAjax["url"]
put "search_term:" && rigJQgetR("'#filter'", "attr", "'value'") into tAjax["data"]
put rigJQsetR("'#results'", "html", "data") into tAjax["success"]

rigJQeventOpen "'#filter'", "'keyup'"
  rigJQajax tAjax
rigJQeventClose

The first parameter is an array of jQuery.ajax settings. If you just want to configure the default Ajax request, set the optional second parameter, a boolean, to TRUE.

Note: To reference the "success:" function argument for any data returned, always use the term "data". Reference the second argument using the term "textStatus", and the third argument using the term "XMLHttpRequest".

rigJQajaxR(ajaxOptions, setUpOnly)

This function does the same as it's equivalent handler (JQajax), but instead of adding the statement to the script, it returns it.

rigJQxhRequest type, URI, data, callback, dataType, Selector

Permits you to load data from the server and, depending on the request type, place the returned HTML into the matched element without a browser page refresh. Example:

rigJQeventOpen "'#filter'", "'keyup'"
  rigJQxhRequest "load", "ajax/datafilter", "search_term:" && rigJQgetR("'#filter'", "attr", "'value'"), , , "'#results'"
rigJQeventClose

The first parameter specifies the type of request, possible values are: "get", "post", "load" and "getJSON". The optional second parameter is a string containing the URI to which the request is sent. The optional third parameter can be a map (JavaScript object), i.e. a Key/Value pair like "key: value", or string that is sent to the server with the request. The optional fourth parameter contains a callback function that is executed when the request completes. Use the terms "data", "textStatus" and "XMLHttpRequest" to reference the arguments of the callback if needed. The optional fifth parameter specifies the type of data that you're expecting back from the server. Available types are: "xml", "html", "script", "json", "jsonp" and "text". The optional sixth parameter specifies the element to place the returned HTML into. This parameter is only relevant, if the request type is "load".

Note: Mind the syntax of the Key/Value pair, a map (JavaScript object), contained in the third parameter. Don't use "get" as request type if query strings are not enabled in config.lc.

Here is another example, which demonstrates the use of a callback:

put rigJQsetR("'#msg'", "html", "data") & return into tCallback
put rigJQalertR("'The data has been loaded'") after tCallback
rigJQxhRequest "post", "myController", "limit: 25", tCallback

rigJQxhRequestR(type, URI, data, callback, dataType, Selector)

This function does the same as it's equivalent handler (JQxhRequest), but instead of adding the statement to the script, it returns it.

rigJQcallFunction selector, functionName, funtionArguments

Permits you to write statements to call any jQuery or any custom function.

The optional first parameter is a selector, use a comma delimited list if you want to deal with more than one element. The second parameter specifies the function name and the optional third parameter contains the function arguments.

rigJQfunctionOpen name, arguments

Tells the library to start writing a custom function.

The first parameter specifies the name of the function and the optional second parameter contains the function arguments as a comma delimited list.

rigJQfunctionClose

Use this handler to mark the end of a custom function.

rigJQcb

Marks the end of a custom function. This is a synonym for JQfunctionClose.

rigJQcondition condition, ifAction, elseAction

Permits you to write a conditional statement. Example:

rigJQcondition "logout==true", "window.location = 'logout';"

The first parameter contains the condition, the second specifies what to do if the condition is met, and the optional third parameter specifies what to do if the condition is not met.

rigJQconditionR(condition, ifAction, elseAction)

This function does the same as it's equivalent handler (JQcondition), but instead of adding the statement to the script, it returns it.

rigJQeachOpen selector, collection, callback

Permits you to iterate over a jQuery object or over both, a map (JavaScript object) or an array, executing a function for each matched element or for each member of a collection.

The first parameter is used to iterate over an object and contains a selector. The second parameter contains a collection, i.e. a map (JavaScript object) or an array. Depending on using the first or the second parameter, the third parameter contains eather a function to execute for each matched element, or a function that will be executed on every member of a collection.

If iterating over a jQuery object reference the function arguments using the terms: "index" and "element". If iterating over a collection use the terms: "index" and "value".

Note: Use eather the first parameter or the second.

rigJQeachOpenR(selector, collection, callback)

This function does the same as it's equivalent handler (JQeachOpen), but instead of adding the statement to the script, it returns it.

rigJQeachClose

Use this handler to mark the end of an iteration.

rigJQeachCloseR()

This function does the same as it's equivalent handler (rigJQeachClose), but instead of adding the statement to the script, it returns it.

rigJQvar vars

Permits you to declare variables. Example:

rigJQvar "previousScroll," & rigJQgetR("'#chatbody'", "attr", "'scrollHeight'")

The parameter can be a string specifying a name and a value delimited by a comma, or an array to declare more than one variable with only one statement. If you use an array stick to the following form: put "name,value;" into tVarsArray[n] where n is an integer starting with 1

Here is another example, which takes the result of a confirmation box as value:

rigJQvar "logout,confirm('Are you sure you want to end the chat session?');"

rigJQvarR(vars)

This function does the same as it's equivalent handler (rigJQvar), but instead of adding the statement to the script, it returns it.

rigJQaddStatement statement

In case your particular needs demand it: Use this handler to add standard jQuery code to your script.