yana

Description
  Class trees
  Index of elements
  Todo List
core
  Classes
    FormCreator
    Index
    Language
    Object
    Plugin
    PluginManager
    Singleton
    SmartTemplate
    SmartView
    Utility
    Yana
database
  Classes
    DbBlob
    DbCreator
    DbDesigner4
    DbExtractor
    DbQuery
    DbQueryParser
    DbServer
    DbStream
    DbStructure
    FileDb
error_reporting
  Classes
    Alert
    Error
    ErrorUtility
    Log
    Message
    Report
    Warning
file_system
  Classes
    DatFile
    Dir
    Executeable
    File
    FileReadonly
    FileSystemResource
    SML
javascript
  Classes
    AjaxRequest
  Functions
    preview
    yanaAddEventListener
    yanaAddIcon
    yanaCheckEmbTags
    yanaCloseAll
    yanaGetCookie
    yanaGetElementsByClassName
    yanaMaxLength
    yanaMenu
    yanaMenuCookie
    yanaSetCookie
mail
  Classes
    FormMailer
    Mailer
plugins
  Classes
    plugin_blog
    plugin_check
    plugin_db_admin
    plugin_db_tools
    plugin_default_library
    plugin_diagnostics
    plugin_guestbook
    plugin_guestbook_admin
    plugin_ipblock
    plugin_ipblock_admin
    plugin_rss
    plugin_rss_admin
    plugin_sdk
    plugin_search
    plugin_search_admin
    plugin_user
    plugin_user_admin
utilities
  Classes
    Brush
    Counter
    Hashtable
    Image
    Microsummary
    RSS
    RSSitem
    String
  Functions
    checkArgumentList
    cloneArray
    dirlist
    qSearchArray
    untaintInput
    XMLencode
vdrive
  Classes
    Registry
    VDrive
zip
  Classes
    PclZip

phpDocumentor v 1.4.0

YANA Framework for PHPDocs For Class AjaxRequest

### Class AjaxRequest

#### Description

«JavaScript» Ajax handling class
Purpose of this class is to send http-requests to a server-side script and output the result to an element in the current document, identified by it's id.
Simple example of usage:

1. // create new instance
2. $http = new AjaxRequest('index.php');
3. // choose where to put the result
4. $http.setTarget('id_of_html_tag');
5. // provide a function to handle the returned result
6. $http.setHandler(function ($httpResponse, $htmlNode)
7. {
8. $htmlNode.innerHTML = $httpResponse.responseText;
9. // this will re-initialize the page (when needed)
10. if (document.body.onload) {
11. document.body.onload();
12. }
13. });
14. // send request to server
15. $http.send('action=' + 'function_name' + '&' + $arguments);

Note: if you use the Yana SDK to create code for a new plug-in, it will automatically provide you with a ready-to-use implementation of a mock object that provides all your available PHP functions via AJAX. Also note that you don't have to change your PHP code to make it "AJAX-ready". A basic AJAX-functionality is already provided by the framework itself, so you don't necessarily need to care about this issue.

##### Variable Summary

function $customHandler
XMLHttpRequest $http
array $instances
bool $isAsynchronous
bool $isReady
string $url

##### Method Summary

- AjaxRequest AjaxRequest ([string $url = null], [bool $synchron = false])
- void send (string $args)
- void setHandler (function $newHandler)
- void setTarget (string $id)

#### Variables

##### function $customHandler = null

Custom callback function
Will be called when a request is ready

- access: public

##### XMLHttpRequest $http = null

Request object of current request (if any)

- access: public

##### array $instances = array()

array containing references to all instances of this class
This is required for the internal dispatcher to notify objects on new events.

- access: public

##### bool $isAsynchronous = true

transfer mode
True = send asynchronous request. False = send synchronous request.

- access: public

##### bool $isReady = false

Ready to send new request
True, when the latest request has already been handled. False, when a recently issued request is still pending.

- access: public

##### string $url = ""

URL of server-side (PHP-)script to handle requests

- access: public

#### Methods

##### create a new instance

AjaxRequest AjaxRequest (
[string $url = null], [bool $synchron = false]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$url | string | server-side script that handles the request
$synchron | bool | set transfer mode

###### Description:

The argument $url is the URL to the server-side (PHP-)script that will handle the AJAX-request(s).

##### send a request

void send (
string $args
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$args | string | will be appended to url

###### Description:

This will send an asynchronous request to the server.
Note: this function does not return a result. Instead the previously specified callback function will be called when the result is finished.
To specify a callback function use AjaxRequest::setHandler().

- access: public
- name: AjaxRequest::send()

##### set the function to handle the response

void setHandler (
function $newHandler
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$newHandler | function |

###### Description:

- access: public
- name: AjaxRequest::setHandler()

##### set the id of the document node to ouput the response text to

void setTarget (
string $id
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$id | string |

###### Description:

By default the result text of the request is copied to the innerHTML property of the node, identified by the id set via this function. However, you may overwrite this behaviour by setting up your own event handler via AjaxRequest::setHandler(). In this case you may use the id-property as a hint for where you intended the output to be placed.

- access: public
- name: AjaxRequest::setTarget()

Documentation generated on Sun, 04 Jan 2009 03:48:44 +0100 by phpDocumentor 1.4.0

yana author: Thomas Meyerwww.yanaframework.net