How do I pass a ColdFusion query object to my cfc function via jQuery Ajax? I am making an ajax call after I run a cfquery like so:
<cfoutput query="data">
<script type="text/javascript">
$.ajax({
url: '/test.cfc',
data:{
q: #data#, //is this how i pass it?
method: "getData"
},
success: function(data) {
console.log(data);
}
});
</script>
</cfoutput>
This seems to pass to my function, but I get a CF error that says:
Complex object types cannot be converted to simple values.
The console says "unexpected end of input". When I click on it,
it highlights the q expression in my ajax call, with the value being:
<!-- " ---></TD></TD></TD></TH></TH></TH></TR></TR></TR></TABLE></TABLE></TABLE></A></ABBREV></ACRONYM></ADDRESS></APPLET></AU></B></BANNER></BIG></BLINK></BLOCKQUOTE></BQ>......
My cfc function is getting called and I have defined an argument with the same name.
<cfargument name="q" type="query" required="true" />
I guess my question is what am I missing or am I not passing the query properly?