COAddOns project site-Add-Ons for MiaCMS, Mambo & Joomla CMS

 Home arrow JavaScript and Ajax arrow Simple AJAX Code-Kit
Get Chitika | Premium
Pick Language to Auto Translate:
AR | BG | CA | CS | DA | DE | EL | ES | FI | FR | HI | HR | ID | IT | IW | JA | KO | LV | LT | NO | NL | PL | PT | RO | RU | SK | SR | SL | SV | TL | UK | VI | ZH | ZT
SiteMap :: Contact Us :: About Us :: Member Blog :: Newsfeeds :: How-To :: News :: CMS Info :: MosNews :: Web Tools :: IRC Chat  

Main Menu
Home
Forums
Downloads
CMS Category
Web Links
FAQs
Blog
MoseCMS
COAddOns Wiki
COAddOns Docs
Drupal resources
Who's Online
We have 1142 guests online
MosCmenuTree

FAQs

Feature Sites
Web Hosting
Q's quickdeals
OpensourceCMS
CMS Matrix
Joomla Extensions
Joomla Templates
Login Form
Username

Password

Remember me
Password Reminder
No account yet? Create one
Donate
Support OngETC in making a small donation:
MapsLink
Locations of visitors to this page
Syndicate

MosNewsWriter

Simple AJAX Code-Kit Print E-mail
User Rating: / 3
PoorBest 
Simple AJAX Code-Kit (SACK)

The Simple AJAX Code-Kit (SACK) is a wrapper class designed to make using AJAX simpler, and easy to implement.

Licenses:
This software is distributed under a Modified X11 licence.

There are two basic elements to this code-kit: Class variables and Class Methods.

Demo page

 Class Variables

(String) AjaxFailedAlert - Holds a warning that will be used to alert users that their browser does not support XMLHttpRequest. To turn off warning set to null. Has a default message.

(String) requestFile - Holds the file that the request will be sent to.

(String) method - The http method used to communicate with the file, can be any valid method though GET and POST will probably be most common. Defaults to POST.

(String) element - The element to replace the contents of with the response text. Is not set by default.

(String) URLString - List of variables and values in GET style format name/value pairs seperated by &'s.

(Boolean) encodeURIString - Whether to escape the data in the string. Set to false if you do this yourself, or use only ASCII characters. Defaults to true.

(Boolean) execute - Set to true if you want to evaluate the response text as if it was javascript code, and run it. Defaults to false.

(function) onLoading - Pass this variable a javascript function without arguments that you wish to run when Loading.

(function) onLoaded - Pass this variable a javascript function without arguments that you wish to run when Loaded.

(function) onInteractive - Pass this variable a javascript function without arguments that you wish to run when Interactive (data is being streamed).

(function) onCompletion - Pass this variable a javascript function without arguments that you wish to run when Completed.

(Array) responseStatus - Array of the response status returned. 0 index is the response code (eg 404, 300, etc) and the 1 index is the text description.

(Boolean) failed - Allows you to detect if the software supports XMLHttpRequest (true) or not (false).

(String) response - The response text recieved from the server.

(String) responseXML - The response xml revieved from the server.


Class Methods

    usage: object sack(string file)
    (Public) Initialising function for SACK Object.
    string file: (optional) The filename of the file to be accessed using XMLHttpRequest. Passes its contents to the requestFile variable.

    usage: void createAJAX()
    (Private) Constructor function for SACK data. Initialises the XMLHttpRequest object in compatible browsers and if this is not supported sets the failed variable to false.

    usage: void setVar(string name, string value)
    (Public) Allows you to add to the URLString data in the form of a name/value pair. Does not encode the data.
    string name: The name of the data that you want passed to the requestFile.
    string value: The corrisponding data that you want passed to the requestFile.

    usage: string encVar(string name, string value)
    (Private) Encodes data, passed in the form of a name/value pair, into a unicode compatible escape sequence. Returns the encoded pair.
    string name: The name of the data that you want passed to the requestFile.
    string value: The corrisponding data that you want passed to the requestFile.

    usage: string encodeURLString(string string)
    (Private) Encodes data, passed in the form of a name/value pair, into a unicode compatible escape sequence.
    string string: The name of the data that you want passed to the requestFile.

    usage: void runResponse()
    (Public) Evaluates the response text as javascript commands, and runs any present.

    usage: string runAJAX(string urlstring)
    (Public) Runs the AJAX request. And fills class variables with appropriate responses (response, responseXML, responseStatus, etc). If the encodeURIString variable is set to true (default) then will escape the name/value pairs in the URLstring variable. If an element has been set then the elements contents (innerHTML or value) will be replaced. If the execute variable is set to true then will call the runResponse method.
    string urlstring: (optional) A string of name/value pairs formatted in the GET URL String style (eg: var1=data1&var2=data2).
Comments

interesting

Posted by carlos, on 11/26/2005 at 12:37

 1 
Page 1 of 1 ( 1 Comments )

You are not authorized to leave comments. Please login first.
Next>




Sponsors

Reseller hosting (free)

000webhost (free)

HostUpon (w/ ssh)

Hosting24 (w/ ssh)

Free TK domain

CO.CC:Free Domain

Get Chitika Premium

Free Windows Hosting


Credit Counseling - Arizona Landscaping - click fraud protection - Renegade Motorhomes
Validate XHTML
Validate CSS