var actions = { unirow:'unis', collegerow:'colleges' // more actions };
$("#edcounty").change(function() { var county = this.value, action = $("#educType").attr('value'); $("#edinst1").show(); if( actions[action] ) $("#edinst2").load('vip/education.php', {action:actions[action],countyme:county}); }); If you really need the variables to be GET, then use this instead of the last line: $("#edinst2").load('vip/education.php?action='+actions[action] +'&countyme='+county); Cheers -- Ariel Flesler http://flesler.blogspot.com On 12 jun, 09:30, Hinch <[EMAIL PROTECTED]> wrote: > I'm coming along OK, my chained combo box is working brilliantly but > the last one needs to be dynamic. > > This is the code I have to power that one: > > $("#edcounty").change(function() { > > $county = $(this).val(); > > $("#edinst1").css("display", "block"); > > if($("#educType").val() == 'unirow') { > $("#edinst2").load("vip/education.php?action=unis&countyme= > $county"); > } > if($("#educType").val() == 'collegerow') { > $("#edinst2").load("vip/education.php?action=colleges&countyme= > $county"); > } > > }); > > It's loading up education.php with default options just fine but I > need the 'countyme' variable in the URL to be dynamic (I have added > '$' to make it stand out and how I want to set it near the top). > > How can I achieve something like this?