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 PTHTTPPOSTRequest.js
Fields inherited from class PTHTTPRequest |
url, type, callback, targetElement, responsePreProcHandler, responsePostProcHandler, concurrencyMode, requestHeaders, properties, _requestForm, formDataSet
|
Constructor Summary |
PTHTTPPOSTRequest
(url, formContent, responseHandler, concurrencyMode, properties)
Creates a new "in-place" client-server POST request
|
className
<private> Object className
properties
Object properties
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
setPostBody
void setPostBody(payload,contentType)
Parameters:
payload
- the text to POST
contentType
- contentType header for POST
setPostBodyXML
void setPostBodyXML(xmlString)
Set XML string as POST body
Parameters:
xmlString
- the XML string to POST
_genSubmitFormHTMLFromForm
<static> <private> Object _genSubmitFormHTMLFromForm(theForm, url)
Generates the submit form html from a form.
This is only used in the case of iframe vehicles.
_genSubmitFormHTMLFromNVPairs
<static> <private> Object _genSubmitFormHTMLFromNVPairs(theArray, url)
Generates the submit form html from an associative array of name/value pairs.
This is only used in the case of iframe vehicles.
Documentation generated by
JSDoc on Tue Sep 21 02:04:06 2010