You don’t have to use a remote proxy with Ajax calls, you can just hit a normal event. That being said, how are you passing structs and queries from a button on a web page?
The structures are being passed as arguments. The function is expecting arguments to be passed in . The only way I know passing the complex data type via ajax id serializing them
Well, I still don’t understand exactly what you’re doing, but I suppose it doesn’t matter since the answer is the same. If you have data in form fields or in JavaScript that you want to send to the server you have two options-- send it as URL variables, or as form data in a POST. Either way, you can point your Ajax at a ColdBox event and the data will show up in the rc scope for you to wrangle.
well I can use post but if the function is expecting arguments like this and I have rc.struct in my collection the function will throw an error saying that the argument is expected but was not passed in.
the form variables are not a problem .
What I have is the following couple of structures , queries in rc collection . then I have a form with the list of checkboxes when the user make a selection I want to call a different function and pass these queries/structures to that function via arguments.
Erok, that is because you are thinking proxy… Forget the proxy and use normal events for the Ajax, normal events pass things via the Request Collection, what that means is that anything i the form or what is posted (whether that be via the URL or Ajax) can be found in the Request Collection.
Ajax is usual different, in the sense that you pass it the URL to succeed the request. But how are you doing the Ajax call, you may need to rewrite that so that you pass the data via the headers (Aka Post).
For what it’s worth, post data is passed via the request body. Regardless, Andrew is right-- your question is how to call an event directly via Ajax, and events don’t have direct arguments passed into them-- the framework handles incoming variables for you. From the framework’s perspective the Ajax call is no different from just hitting the page in your browser.
Well I may misunderstood something here For Example I have a page that have a rc collection. When The button is clicked I am calling another page using ajax. The question is will I override the previous rc collection with the newly called page. I think I will. I am serializing the params that being passed through the ajax and I arrive to the landing page I decerialize them back
No, the Request Collection is as the name suggests, it is a collection of variables that are defined at run time. In the same manner that ColdFusion has the request scope.
Having said that, the RC exists on the server and what is in the client becomes irrelevant, what is relevant is how you send the data back to ColdBox. You can persist the RC over to the next request only, but still has nothing to do with the Client side.