nope.
from gluon.serializers import json
def index():
python_object = dict(a=1, b=2)
return dict(json_object=json(python_object))
and then you can do
<script>
var t = {{=XML(json_object)}};
alert(t);
</script>
in the view.
On Thursday, November 7, 2013 8:28:23 PM UTC+1, Gaurav singh wrote:
>
> I am converting a python array p to javascript array using var t=
> {{=XML(response.json(p))}} but when i check it using alert(t); i get an
> empty pop up box :/ , Please help me
>
> On Saturday, 2 November 2013 19:40:34 UTC+5:30, Massimo Di Pierro wrote:
>>
>> What do you mean it is not? It should. Can you provide a more complete
>> example?
>>
>> On Friday, 1 November 2013 14:18:35 UTC-5, Gaurav singh wrote:
>>>
>>> I am using {{=XML(response.json(array))}} for converting python array to
>>> javascript array in views but it aint working , it just converts a python
>>> variable or string to a javascript variable but it aint doing the same with
>>> an array or list ? Please help me , Is there any other alternative way of
>>> any other json command for the same ?
>>> Thanking You
>>> Gaurav Singh
>>>
>>
--
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/groups/opt_out.