If you are using an ajax component, then just set response.flash, and it 
will work automatically. For other ajax calls, I think you can trick web2py 
into treating it like a component (for flash message purposes) by setting 
request.cid=True (or setting it to any value that won't evaluate to False) 
-- that will cause web2py to add the message in response.flash to the 
"web2py-component-flash" response header, which will be used on the client 
side to display the message upon successful completion of the ajax call. 
Note, you can also manually set that header:

import urllib2
from gluon.html import xmlescape
response.headers['web2py-component-flash'] = urllib2.quote(xmlescape(
response.flash).replace('\n',''))

Anthony

On Friday, May 24, 2013 9:22:12 AM UTC-4, software.ted wrote:
>
> is there a way of calling a flash message defined in web2py when an ajax 
> call is made...like the way it is in twitter 
>
> -- 
>
> .......................................................................................
> Teddy Lubasi Nyambe
> Opensource Zambia
> Lusaka, ZAMBIA
>
> Cell: +260 97 7760473
> website: http://www.opensource.org.zm
>
> ~/
> Human Knowledge belongs to the world! - AntiTrust
>
> Man is a tool-using animal. Without tools he is nothing, with tools he is 
> all - Thomas Carlyle 1795-1881
>
> /~ 
>

-- 

--- 
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/groups/opt_out.


Reply via email to