Monday, September 08, 2008    
Home My Books Blog ColdFusion About Me Back    

Calendar
<< Oct 2007 >>
S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Search

Categories
 • Acrobat (2) [RSS]
 • Adobe (67) [RSS]
 • AdobeMAX06 (45) [RSS]
 • AdobeMAX07 (59) [RSS]
 • AdobeMAX08 (22) [RSS]
 • AIR (126) [RSS]
 • Appearances (118) [RSS]
 • Books (68) [RSS]
 • CFEclipse (14) [RSS]
 • ColdFusion (1143) [RSS]
 • Data Services (12) [RSS]
 • Fish Tank (2) [RSS]
 • Flash (103) [RSS]
 • Flex (365) [RSS]
 • Home Automation (3) [RSS]
 • Jobs (93) [RSS]
 • JRun (12) [RSS]
 • Labs (27) [RSS]
 • LiveCycle (21) [RSS]
 • MAX (157) [RSS]
 • Regular Expressions (12) [RSS]
 • RIA (4) [RSS]
 • SQL (37) [RSS]
 • Stuff (503) [RSS]
 • Tips (CF Studio) (80) [RSS]
 • Tips (CF) (795) [RSS]
 • Tips (Dreamweaver) (91) [RSS]
 • Tips (Flex Builder) (2) [RSS]
 • Using CF (136) [RSS]
 • Wireless (97) [RSS]

Other BLOGs
 • Charlie Arehart
 • Lee Brimelow
 • Ray Camden
 • Christophe Coenraets
 • Sean Corfield
 • Mihai Corlan
 • Cornel Creanga
 • John Dowdell
 • Danny Dura
 • Enrique Duvos
 • Steven Erat
 • Kevin Hoyt
 • Serge Jespers
 • Adam Lehman
 • Duane Nickull
 • Miti Pricope
 • Andrew Shorten
 • Ryan Stewart
 • James Ward
 • Greg Wilson
 • Full As A Goog

RSS Feeds
 • Feed
 • Subscribe

Join my mailing list and find out about new books and other topics of interest.

Thoughts, ideas, tips, musings, and pontifications (not necessarily in that order) by Ben Forta ...
NOTE: This is my personal blog, and the opinions and statements voiced here are my own.

Viewing By Entry / Main
October 15, 2007

Using POST For ColdFusion Ajax Calls

A ColdFusion user asked me (at MAX) how to get ColdFusion's Ajax calls to use POST instead of the default GET. The answer, courtesy of ColdFusion team member Rakshith, is to use <CFAJAXPROXY> to define the proxy CFC, and then use the setHTTPMethod() method to set the method type. Here is Rakshith's example:

<html>

<head>

<script type="text/javascript">
function test()
{
   Var abccfc = new abc();
   abccfc.setHTTPMethod("POST");
   // All method calls on this instance will henceforth use POST instead of GET
   abccfc.somemethod();
}
</script>

</head>

<body>
   <cfajaxproxy cfc="abc">
   <cfinput type="button" name="test" onclick="test();">
</body>

</html>

TrackBacks
There are no trackbacks for this entry.

No trackback URL. Trackbacks are only allowed via interactive form.

Comments
Don't forget about ColdFusion.Ajax.submitForm().
# Posted By Raymond Camden | 10/15/07 11:42 AM
This comes really handy with large amount of text being posted .. last month I learned about the setHTTPMethod() the hard way since I had a page that posted a large amount of text and I kept getting an error in IE (suprised?) but it was working in Firefox. So if you are getting an error when using IE, check that you are setting the http method to "POST".

thanks for posting this Ben...
# Posted By phill.nacelli | 10/15/07 11:45 AM
ColdFusion.navigate also lets you set the http method:

ColdFusion.navigate(URL [, container, callbackhandler, errorhandler, httpMethod, formId])
# Posted By todd sharp | 10/15/07 12:09 PM

  © Copyright 1997-2008 Ben Forta, All Rights Reserved