I have a Button with some data-attributes and a Component MyComp.
When the Component is called, a function should be run before : executeMyComp(sfWebRequest $request). Into my executeMyComp I do some Propel SQL but i need some a Variable send from the Button through AJAX.
- should the Ajax save the Variable into the Symfony Session? if yes how?
- Or should i send through Ajax a sfWebRequest if yes how?
Thank you.
for function before
executeMyCompyou can usepreExecutefunctions. they run before actual actions and you can write your code by checking if it’s an specific action by using getModuleName and getActionName methods.and about your second question, i always use JQuery Ajax functions because by using prototype ajax there is always some conflicts. it’s so simple to use and you can send values with the request to an specific action. so there is no need to add them to session
of course there is no need to say that you can save your attributes via jquery to a variable before send them via ajax by something like this: