I have a pretty standard contact form that uses a cfc for processing now. I want to use .post for users that have javascript turned on. I've created an array with jQuery of the form elements and I want to pass that to the same CFC (without modifying the CFC) but I'm not certain how to do it. Basically, I want to pass something called 'formData' as an argument to the CFC (as I do with just the basic server side code), and then parse it in the CFC. Right now I'm just using a cfdump in the cfc (which works fine with a non-java submit) but it doesn't work with this set-up. Any ideas?
Here's my jQuery
$('#theForm').submit(function(e) {
e.preventDefault();
var formData = {};
$('form [name]').each(function(){
formData[this.name] = this.value;
});
$.post("cfc/engine.cfc?method=collectdata&returnformat=json",
{'formData': formData}
);
});
And my CFC
<cffunction name="collectdata" access="remote" output="false" returntype="void">
<cfargument name="formData" type="struct" required="yes">
<cfdump var="#formData#">
<cfabort>
</cffunction>