Does it work if you pass the request arg as an argument to the function:
@service.json
def search(keyword):
query = db.search.title.contains(keyword, all=True)
return db(query).select()
On Monday, December 12, 2011 9:44:50 PM UTC-5, lyn2py wrote:
>
> I have followed the instructions from the book
> http://web2py.com/book/default/chapter/09
> But it is not working for me, please point out my errors!
>
> #controller
> @service.json
> def search():
> query = db.search.title.contains(request.args(0), all=True)
> return db(query).select()
>
> def call():
> return service()
>
> #browser calls
> .../app/controller/search/title = Works
> .../app/controller/call/json/search/title = empty JSON array
>
> I also tried changing json to xml, but it returns empty
>
>