Please read the ajax() function documentation for proper usage:
http://web2py.com/books/default/chapter/29/11#The-ajax-function.
The ajax() function takes a URL as the first argument. Instead, you are
supplying the following string: *'order_update, vars=dict(id={{=p.id}},
qty={{=qty}})'*. I assume you want ajax('{{=URL('order_update,
vars=dict(id=p.id, qty=qty))}}', ...).
Anthony
On Tuesday, February 19, 2013 10:17:32 PM UTC-5, 黄祥 wrote:
>
> hi,
>
> i'm trying to update session data variable using java and not working.
>
> for example :
> *#controller*
> def order_update():
> id=int(request.vars.id)
> qty=int(request.vars.qty)
> # session.order.get(id, 0)=qty
> session.order[id]=qty
> return locals()
>
> *#view*
> <table width="100%">
> {{for id, qty in order.items():}}
> {{p=db.product(id)}}
> <tr>
> <td>{{=p.product_name}}</td>
> <td><form><input id="{{='qty_%s' % p.id}}" name="quantity"
> value="{{=qty}}" *onkeyup="ajax('order_update, vars=dict(id={{=p.id}},
> qty={{=qty}})', ['quantity'], '{{='qty_%s' % p.id}}')"*></form></td>
> </tr>
> {{pass}}
> </table>
>
> if already check inspect elements :
> <input id="qty_98" name="quantity" value="2" onkeyup="ajax('order_update,
> vars=dict(id=98, qty=2)', ['quantity'], 'qty_98')">
>
> is there any way out to update the session variable using ajax form keyup
> events?
>
> thank you so much in advance
>
--
---
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/groups/opt_out.