Solved :) I was trying to pass data within the script with python 
variables. Does not work apparently.


On Tuesday, October 23, 2012 2:35:49 PM UTC+2, Richard wrote:
>
> Hi,
>
> I want to show pictures belonging to a certain city. In the latter example 
> The data send includes as 3rd element 'Bangkok'. I can't use this 
>  request.args[2] not is the selection. Plain 'Bangkok' in stead 
> of request.args[2] in the selection gives the wanted pictures.
>
> What is wrong?
>
> VIEW:
> get_images('Bangkok')
>
> function get_images(data){
>       console.log('data sent');
>       console.log(data)
>      $.getJSON(' {{=URL('call', args=['json', 'images_ws', 'Bangkok'] 
> )}}', function(data){
>       console.log('data back');
>       console.log(data);      
>       update(data)
>      })
> }
>
> CONTROLLER:
> @service.json
> def images_ws():
>     requested_loc = request.args[2]
>     loc = db(db.loc.name==requested_loc).select()[0]
>     pictures = db(db.image.loc==loc.id).select().as_list()
>     return pictures
>

-- 



Reply via email to