Class PTHTTPPOSTRequest
Object
|
+--PTHTTPRequest
|
+--PTHTTPPOSTRequest
- class
PTHTTPPOSTRequest
- extends PTHTTPRequest
Object wrapper for "in-place" client-server POST operations. Invoking a PTHTTPPOSTRequest
will cause a background HTTP request to be sent to the server without reloading the contents
of the browser. PTHTTPPOSTRequests can be set to automatically refresh the inner HTML of an
element on the page, or to have the HTTP response that they generate be handled by a
JavaScript function. All the form input values (with the exception of file inputs)
will be transmitted in the PTHTTPPOSTRequest.
Usage:
// refresh the content of an element
var myform = document.forms[0];
var request = new PTHTTPPOSTRequest(myform.action, myform, document.getElementById('refresh-elem-id'));
request.setRequestHeader('my-custom-header', 'headervalue');
request.invoke();
OR
// invoke a response handling function
var myform = document.forms[0];
function handleResponse(resp) { alert(resp.responseText); }
var request = new PTHTTPPOSTRequest(myform.action, myform, handleResponse);
request.invoke();
Defined in PTXML.js
Field Summary |
<static> <final> Object |
VERSION
|
Constructor Summary |
PTHTTPPOSTRequest
(url, formContent, responseHandler, concurrencyMode, properties)
Creates a new "in-place" client-server POST request
|
Method Summary |
void
|
setFormContent(formContent)
Sets the form content for the request.
|
VERSION
<static> <final> Object VERSION
PTHTTPPOSTRequest
PTHTTPPOSTRequest(url, formContent, responseHandler, concurrencyMode, properties)
Creates a new "in-place" client-server POST request
Parameters:
url
- Server-side request URL (string)
formContent
- The content to be posted (Associative array of name/value pairs to x-www-form-urlencode, or a Form element/name/id). Note that form elements of type FILE, IMAGE, and SUBMIT are ignored when passed as formContent. If you need the value for a submit element to be passed via formContent, you should create a HIDDEN element whose name and value are equivalent to the SUBMIT element, and the HIDDEN element will be passed through in its place.
responseHandler
- This can be either a callback function to call and pass back results of the request (string or Function) or it can be a target HTML element, whose innerHTML property will be set from the response test ()
concurrencyMode
- How to handle concurrent requests, optional (PTHTTPTransport.CCMODE_? constant value)
properties
- Associative array of key/value pairs available for arbitrary use, optional (Object)
setFormContent
void setFormContent(formContent)
Sets the form content for the request.
Parameters:
formContent
- a form tag or id of the form
Documentation generated by
JSDoc on Wed Aug 24 10:17:38 2005