Question about the code, in the change() event, why are you calling two functions for the callback? I though change() could only get one function as a parameter.
On Jun 23, 11:44 am, 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?