FYI, already answered at https://stackoverflow.com/a/73338318/440323.
On Saturday, August 13, 2022 at 10:37:06 PM UTC-4 JPlata wrote: > <https://stackoverflow.com/posts/73330794/timeline> > > I have two dropdown/select widgets on a form. I am trying to set the > options of the second select through an ajax call in jQuery, and then > execute further code. The ajax call is successful and correctly sets the > second select options, but it seems the code after the ajax call is not > executed at all. How to correct this? > > view: > > > {{extend 'layout.html'}}` <h1>{{=title}} /This is the > library/edit_user.html template</h1> {{=grid}} <script> > jQuery("#no_table_region_id").change(function(){ region_id = $(this).val(); > branch_id = jQuery('#no_table_branch_id').val(); ajax("{{=URL('library', > 'branches')}}" + '?region_id=' + region_id, [], 'no_table_branch_id'); > jQuery('#no_table_branch_id').val(branch_id); # this does not execute }); > jQuery(document).ready(function(){ // todo: solve the unsettable branch_id > jQuery("#no_table_region_id").change(); }); </script> > > controller: > > def branches(): if request.vars.region_id: branches = > db(db.branch.region_id==request.vars.region_id).select(db.branch.ALL) > ops1 = ['<option value=""></option>'] ops = ops1 + [f"<option value={i[ > 'id']}>{i['branch_name']}</option>" for i in branches] else: ops = '' > return ops > > > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/4b1863dc-4f9b-41d8-9d10-2c9e2c971662n%40googlegroups.com.