User Guide

Table Of Contents
838 Chapter 34: Using Server-Side ActionScript
Referencing HTTP Post parameters in the CF.http function
To pass HTTP
Post parameters in the CF.http function, you must construct an array of objects
and assign this array to a variable named
params. The following arguments can only be passed as
an array of objects in the
params argument of the CF.http function:
In the following example, the
CF.http function passes HTTP Post parameters in an array of
objects:
function postWithParamsAndUser()
{
// Set up the array of Post parameters. These are just like cfhttpparam tags.
params = new Array();
params[1] = {name:"arg2", type:"URL", value:"value2"};
url = "http://localhost:8500/";
// Invoke with the method, url, params, username, and password
result = CF.http("post", url, params, "karl", "salsa");
return result.get("Filecontent");
}
Using the CF.http Post method
You use the
Post method to send cookie, form field, CGI, URL, and file variables to a specified
ColdFusion page or CGI program for processing. For POST operations, you must use the
params argument for each variable that you post. The Post method passes data to a specified
ColdFusion page or an executable that interprets the variables being sent, and returns data.
For example, when you build an HTML form using the
Post method, you specify the name of
the page to which form data is passed. You use the
Post method in the CF.http function in a
similar way. However, with the
CF.http function, the page that receives the Post does not display
anything. See the following example:
function postWithParams()
{
// Set up the array of Post parameters. These are just like cfhttpparam tags.
// This example passes formfield data to a specified URL.
params = new Array();
params[1] = {name:"Formfield1", type:"FormField", value:"George"};
params[2] = [name:"Formfield2", type:"FormField", value:"Brown"};
Parameter Description
name The variable name for data that is passed
type Transaction type:
URL
FormField
Cookie
CGI
File
value Value of URL, FormField, Cookie, File, or CGI variables that are passed