Link to home
Start Free TrialLog in
Avatar of V. T.
V. T.

asked on

Use an Ajax fuction to change a Case of a CFswitch expression by clicking on a submit button

Good Morning Dear Expert,

I'm actually using Cfswitch expression to play several module on the same page with a page's "refreshment" when i submit the form.. i would like to use Coldfusion and Ajax for a different experience.. Is it possible on a input or submit Click, to call an Ajax function on the same page and in this function, change the variable of the CFcase expression to play a different mudule ?

Any response will be helpful..
Avatar of _agx_
_agx_
Flag of United States of America image

Click, to call an Ajax function on the same page and in this function, change the variable of the CFcase expression to play a different mudule ?

No.  Javascript code executes long after the CFML code is finished, so it can't change any CF variables.  In order to modify any variables in the current .cfm script, you must resubmit the form.

What you can do with ajax, is submit an HTTP request which returns HTML. Then use the HTML content to populate an element on the current page using javascript.
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of V. T.
V. T.

ASKER

A helpful alternative !
Thank you _agx_.
You're welcome. Glad it helped!