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,

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to