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 CF.http
in a similar way. However, with CF.http
, the page that receives the Post does not display anything.
function postWithParams()
{ // Setup 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"}; url = "http://localhost:8100/"; // Invoke CF.http with the method, url, and params result = CF.http("post", url, params); return result.get("Filecontent"); }