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 to define the proxy CFC, and then use the setHTTPMethod() method to set the method type. Here is Rakshith's example: function test() { Var abccfc = new abc(); abccfc.setHTTPMethod("POST"); // All method calls on this instance will henceforth use POST instead of GET abccfc.somemethod(); }
Using POST For ColdFusion Ajax Calls
5 Comments
T
ColdFusion.navigate also lets you set the http method:
ColdFusion.navigate(URL [, container, callbackhandler, errorhandler, httpMethod, formId])
P
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...
R
Don't forget about ColdFusion.Ajax.submitForm().
J
Great. This is exactly what I needed. I was posting too much data for GET. Thank you!
A
Alan M
Thank you! Exactly what I needed - over five years after you posted it :).