//AJAX request for a new dropdown with subcategory contents function updateDropdown (elementID) { //Select the element we want to get the ID from var elWithData = document.getElementById('catDropdown['+elementID+']'); //Get ID of category to fetch if (elWithData != null) { categoryToSelect = elWithData.value; } else { categoryToSelect = '0'; } //Update page using AJAX call if (categoryToSelect && categoryToSelect != '0') { updatePage ('http://www.gotop100.com/ajax/ajax_subdirectories.php?dirCat='+categoryToSelect+'&selectID='+(elementID+1)); } else { updatePage ('http://www.gotop100.com/ajax/ajax_subdirectories.php?reset=1&selectID='+(elementID+1)); } }