You need use:

   var = json.loads ( request.post_vars.items[*"*json1*"*] )


El mié., 20 de nov. de 2019 a la(s) 14:08, Patito Feo (
patitofeo...@gmail.com) escribió:

> Hi,
>
> Ive been trying to pass an object with keys to the controller. But i
> havent been able to extract the request.vars.
>
> Here is my view:
>
> var Cars = {}
> Cars.make = 'Ford';
> Cars.model = 'Mustang';
> Cars.year = 1969;
>
> $.post( "{{=URL('default', 'transcriptor')}}", //request.post_vars.json1
>    {
>          tarea: 'solicitudguardar', items: { json1: JSON.stringify( Cars )
> }
>    }, )
>
>
> Here is my function:
>
> elif request.vars.tarea == 'solicitudguardar':
>
>    var = json.loads ( request.post_vars.items[json1] )
>
>
>
> Here is one of the errors i got:
>
> global name 'json1' is not defined
>
>
> I dont understand why the array object is not being process as a json
> array in controller.
>
> Any help will be much appreciated.
>
>
> Cheers,
>
> --
> 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 web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/cb71d997-01f3-4dd3-b689-35c280e035b7%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/cb71d997-01f3-4dd3-b689-35c280e035b7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAHxJ-7pDW9q03HMwjcOzc6JWovRTLTDTZ3S5o32rYG8JfUb8tw%40mail.gmail.com.

Reply via email to