Search code examples
javascriptajaxcoldfusioncfccffunction

Call Javascript function from ColdFusion CFC


I have a ColdFusion function that checks if a record exists in a table, and if it does it returns data for the row found. However, if the record does not exist, I would like to have it make a call to a JavaScript function that I've written and use the value that is returned from the JS function to continue processing in the CF function. I know that CF is written in Java, so I'm hopeful that there is someway to perform this task.

Basically, from CF page, the steps would be...

  1. Call CF Function located in my functions.cfc file
  2. Within the CF function, make call to JavaScript function and wait for response
  3. Continue processing in CF function using the value returned from the JS function.

Any ideas? Thank you for any help!


Solution

  • Was over complicating things trying to use javascript for the ajax call. Just switched over to using cfhttp and all is working as needed. DeserializeJSON method of CF works great to parse the json object returned from the Google API.