Hello.
Keep in mind that ajax() - is a simple web2py function  which is based on 
Jquery (see web2py.js , its  code  is very short and clear)
It can pass to controller  the values of the input elements only, see 
http://api.jquery.com/serialize/. 
So your select controls must have a  name   
- <select name="any_name_1" ...

To pass its  values just include its names in ['  '] -  ajax('{{=URL('
default','get_options_for_dropdown2')}}', ['any_name_1,  any_name_2, ...'], 
'dropdown2');">
To get it in the controller: 
get_options_for_dropdown2.vars.any_name_1



On Tuesday, August 11, 2015 at 6:43:59 PM UTC+3, Gael Princivalle wrote:
>
> Hello.
>
> I'm still making a form like in this post:
>
> https://groups.google.com/forum/#!searchin/web2py/jquery$20db/web2py/tvfncYsLrQs/MRHG5MWOMlAJ
>
> <!-- DROPDOWN1-->
> <select onchange="jQuery('#dropdown2').empty(); ajax('{{=URL('default','
> get_options_for_dropdown2')}}', [''], 'dropdown2');">
>     <option...
> </select>
> <span id='dropdown2'>
> <!-- DROPDOWN2-->
> <select id='dropdown2'>
>     <option...
> </select>
>
> How is it possible to pass like a var the current select option value to 
> the ajax call?
>
> With something like that?
> data: {value: $('#select option:selected').val()}
>
> How it will be possible to retrieve this in the controller?
>
> Thanks.
>

-- 
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.

Reply via email to