Hi everyone,
I currently have a function in the default.py controller like the one below:
def overview():
some code goes here
return dict(income=json(income), form=form, bank=bank)
The first variable is passed to the javascript tag in order to render a chart trough Chart.js
The last two variables are passed to the body of the view in order to render a form and generate a bank integer argument to redirect to a different controller/function upon clicking on an <a> tag.
As it is, everything is working great.
I was just wondering whether there is a way to make the first variable be retrieved by an AJAX function while the two others be sent to the view.
I can do it by creating two functions like these, but I need everything in the same controller:
def json_function():
some code here
return response.json(income)
def overview():
some code goes here
return dict(form=form, bank=bank)
Can I write these actions in just one controller?
My intention is to update the chart through an Ajax call without refreshing the page.
Many thanks.
Cheers,