here i've been working with this for the past few days. it should do the trick
http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/ On Jun 23, 2:44 pm, Paul <paulverh...@gmail.com> wrote: > Hi there, > > This is what I'm trying to do: > > When a user selects a group in the first SELECT box, another SELECT > box should be loaded from an external PHP-file (using MySQL), based on > the group-id of the first SELECT box. > > I use this code: > > $('#kiesgroep').change(function(){ > $.post("<?php echo base_url();?>php/kies_speltak.php", { > groepid: $('#kiesgroep').val() > }, function(response){ > $('#kiesspeltakveld').fadeOut(); > setTimeout("finishAjax('kiesspeltakveld', '"+escape(response) > +"')", 200); > }); > return false; > }).change(); > > function finishAjax(id, response) { > $('#'+id).html(unescape(response)); > $('#'+id).fadeIn(); > > } //finishAjax > > where #kiesspeltakveld is the field where the second SELECT box should > be loaded, > and #kiesgroep is the id of the first SELECT box. > But now the problem is that the second SELECT box gets loaded when the > page loads, NOT when the first SELECT box gets changed. Does anyone > know why?