[web2py] Re: Autocomplete JSON output format.

2020-07-28 Thread Jose C
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

[web2py] Re: Autocomplete JSON output format.

2020-07-28 Thread 'Annet' via web2py-users
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

[web2py] Re: Autocomplete JSON output format.

2020-07-28 Thread Jose C
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