why the data represent in views is loaded faster using for loop python rather than using response json? is it normal or maybe something wrong with my code? *e.g.* *controllers/api.py* @auth.requires_login() @request.restful() def json_pie_test(): def GET(id): query = (db.product.id == id) rows = db(query).select(orderby = ~db.product.id, cache = cache_db, cacheable = True) rows_list = [] for row in rows: rows_list.append([T(row.product.name, lazy = False), row.price] ) return response.json(rows_list) return locals()
*controllers/default.py* @auth.requires_login() def index(): query = (db.product.id == 1) rows = db(query).select(orderby = ~db.product.id, cache = cache_db, cacheable = True) return locals() *views/default/index.html* ... <script> $(function () { $(document).ready(function () { *// pie json url* $.getJSON('127.0.0.1:8000/test/api/json_pie_test/1.json', function(data) { $('#pie_json').highcharts({ ... series: [{ type: 'pie', name: '{{=T('JSON') }} ', data: data }] }); }); *// pie python for loop loaded faster, show pie chart first* $('#pie_python').highcharts({ ... series: [{ type: 'pie', name: '{{=T('Python') }} ', data: [ {{for row in rows:}} ['{{=T(row.product.name) }}', {{=row.price}} ], {{pass}} ] }] }); }); }); </script> thanks and best regards, stifan -- 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. For more options, visit https://groups.google.com/d/optout.