On Tuesday, March 29, 2016 at 6:09:57 AM UTC-4, Jacob Devin wrote:
>
> view:
>
> {{extend 'layout.html'}}
> {{for row in rows:}}
> <h3>
> {{=row.name}}
> </h3>
> <br>
> <a href="ajax('{{=URL('default','about_group')}}',[row.id],'target');">check
> 'about'
>
Please review the documentation. The second argument to the ajax() function
is a list of "name" attributes of form input elements -- it cannot simply
be a list of raw data values you want to pass to the server (and you
certainly shouldn't expect the Python identifiers used in the template to
appear in request.vars -- the Javascript code never even sees those
identifiers). In this case, because you are not extracting values from form
input elements but simply want to pass existing data values, you should
instead add those values to the URL itself:
ajax('{{=URL('default', 'about_group', args=row.id)}}', [], '{{=row.id}}')
With the above, in the controller you can get the value of row.id via
request.args(0). Also, note the change of the "target" argument to the
row.id value -- this will ensure that each target element gets its own
unique ID (you cannot give the same CSS id to multiple elements on the
page).
Anthony
--
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.