Re: web2py view to controller value passing and vice versa

586 views
Skip to first unread message

Tim Richardson

unread,
May 29, 2013, 9:31:53 PM5/29/13
to web...@googlegroups.com


how to get the returned value in view again??

The view is executed by the server, so variables included in the view are provided by the web2py server process executing code at the time the content is sent to the browser; you are returning a value via ajax which sends it to the client (the browser) some point after the view has been generated.

 

Anthony

unread,
May 29, 2013, 10:18:39 PM5/29/13
to web...@googlegroups.com
When you say you want the value in the "view", do you really mean you want it on the web page in the client? As Tim pointed out below, the view is a file on the server that is executed on the server -- it generates an HTML page that is then sent to the browser -- however, the view itself is not in the browser.

It would help if you could explain exactly what you are trying to do. What would you like to happen when the user clicks the link/button?

Anthony

Richard Prabhu

unread,
May 30, 2013, 2:32:02 AM5/30/13
to web...@googlegroups.com
hello anthony,
i have a doubt in web2py.
I am developing an application using web2py. In my view i have an onclick event which is using an ajax function to send the data to the controller and the controller will process the value  and send back the data to view.How to get the value in view i want to display in the webpage.

View:

onclick='ajax("{{=URL('default', 'test', args=[textname[i], '2', 'tamil'])}}",[], ":eval");'

controller:

if (request.args[2]=="tamil"):
        if (int(request.args[1])==1):
            galatta = get_hlink('http://www.galatta.com/tamil/reviews/','','href="/tamil/reviews/',name_key,'','')
            messag=get_content(galatta,'itemprop="description"','itemprop="image"','')
            return  messag


pls help me with this.am struck

Anthony

unread,
May 30, 2013, 8:39:13 AM5/30/13
to web...@googlegroups.com
Did you read my response here: https://groups.google.com/d/msg/web2py/yC9e4gy-t1k/SPpTjGyYLQQJ? We need more information about what you are trying to do? Where is that "onclick" handler, and what do you want to happen on the page when it is clicked?

Anthony
Reply all
Reply to author
Forward
0 new messages