How to call a def with request.vars arguments from an onclick-event in a
view file? What is wrong with the code?
Thanks in advance for help!
Controller:
def insnext():
nodename=request.vars['nodename']
nrowid=request.vars['nrowid']
db.next_list.update_or_insert(**db.next_list._filter_fields({ "node" :
nodename , "next_node":nrowid }))
def delnext():
nextrowid=request.vars['value']
db(db.next_list.id==nextrowid).delete()
View:
<button onclick="jQuery.ajax('{{=URL('delnext',
vars=dict(value=str(nextrowid)))}}');ch{{=nrowid}}();">delete</button>
<button onclick="jQuery.ajax('{{=URL('insnext',
vars=dict(value=str(nextrowid)))}}');window.location.reload();">insert
{{=nrow['name']}} {{=nrowid}}</button>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/aaed257d-7d4b-45b7-bcc7-7a21628a0a70n%40googlegroups.com.