Tuesday, 15 June 2010

javascript - Passing data from Jinja back to Flask -



javascript - Passing data from Jinja back to Flask -

how pass info jinja-templated page flask?

say print list of items. user chooses item, can grab via javascript.

what best practice pass chosen item argument function generate item's own page?

note: html mean html incl. javascript etc.

python web app receives http request render page python code in controller asks python model prepare info rendering html page jinja2 jinja2 template renders html page python web app sends resulting page client client clicks on element on page. result in new http request new html page, or can ajax request (asynchronously performed http request initiated javascript on html page in browser), asks web app new info or provides web app new information. web app (python) receives request, create changes in model content , can homecoming response javascript javascript receives new info , uses them update html page in browser.

as seen, jinja template tool, allows rendering html page. direct interaction web app providing renderd html content, there no chance include user interaction in content @ moment, client did not see page yet, has provided python code.

the way, how can in jinja template inform python code user interaction indirect round trip described above.

javascript python flask jinja2 jinja

No comments:

Post a Comment