Note, response.js only works with Ajax requests, so it will have no effect 
in this case. Instead, just use the LOAD helper, and include it 
conditionally in the view:

In views/default/index.html:

{{if form.accepted:}}
{{=LOAD('default', 'graph1.load', ajax=True)}}
{{pass}}

Anthony

On Monday, June 30, 2014 8:23:53 AM UTC-4, Richard wrote:
>
>
> Dear web2py colleague,
>
> I am struggling with the response.js in order to load a component.
>
> Loading a component through {{=LOAD....}} works fine.
> We want to load that component after accepting and processing a form. So i 
> put a named div in the view and let response.js do the loading by the form 
> processing.
>
> controller:
>
> def index():
>     if form.process().accepted:
>           response.js = '$.web2py.component("%s", target="graph1");' % 
> URL('default', 'graph1.load')
>
> index.html:
>
>      <div id="graph1" style="width: 400px; height: 400px; margin: 0 auto">
>      </div>
>
> Besides this simplifying the case looks that my app does not listen to 
> response.js because just adding the following line does not add the 
> specified HTML tot the div with id location1:
>
>       response.js = '$.( "#graph1" ).append( "<p>Test</p>" );'
>
>
> Sorry for being inpatient because this question is repeated from this tread
> https://groups.google.com/forum/#!topic/web2py/nbOpM-0_QvA
> but this is standard web2py.
>
> Thank you for the support.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to