I'm developing a simple(!) 2 page application.
Page1: Takes basic details from the user about the program is creating for his trip - name of the trip, dates etc.
After clicking Save, a entry is created on MongoDB using controllers in Lithium PHP for the program. A id is generated and passed on to page 2 as a parameter in URL like so:
$this->redirect('/iplans/save/' . $program_id . '/' . $program_name);
Page 2: is a single page application using many Backbone scripts (hosted in individual js files) and allows the user to add datewise details of his program. No js script is in-line.
I want the backbone collection to be saved on the server side when Finish is pressed but need to send in the program_id with this collection so that the right program is updated in MongoDB.
Questions:
- How does one ensure that the program_id from lithium/php server side is picked up by backbone javascripts that are in their own js files (not inline)
- What other options are available besides Controller::redirect to forward the control from page1 to page2?
- What other options can be used to pass-on the program_id and any other values that may be needed to backbone/JS layer. Is there a standard-way of passing such items?