I suspect that it has to do with the headers that are set on the response
object.
When calling the function with .json extension (as in my example) the
content-type headers are automagically set by web2py to application/json
and the content formatted accordingly.
>From what I can tell, you
Hi Jose,
Thanks for you reply.
Following your suggestion, and making one adjustment:
return dict(suggestions=json.dumps(countries))
the controller/function jsonsource/name_autocomplete now returns a correct
list:
["first_option", "second_option", "third_option"]
In layout.html before the cl
One way to get your 2nd option:
in controller:
def country_list():
countries = []
for rec in db(query).select(db.vtx_vertex.name, left=left, distinct=True,
orderby=db.vtx_vertex.name):
countries.append(rec.name)
return dict(suggestions = countries)
in the view (js), call the
3 matches
Mail list logo