I've got this Ajax call that basically populates a dropdown box dynamically, however occasionally it seems to get stuck and just sits there doing nothing, if I reprompt it by changing the dropdown before it, it then works.
Somehow I need to add a timeout and retry into the code chunk below - any ideas how?
function getTownsResorts(sel)
{
var TheProvinceID = sel.options[sel.selectedIndex].value;
document.getElementById('UrbanizationID').options.length = 0; // Empty city select box
if (TheProvinceID.length > 0) {
var index = ajax.length;
ajax[index] = new sack();
ajax[index].requestFile = 'scripts/ajax/ajax_GetUrbanizations.php?ProvinceID=' + TheProvinceID; // Specifying which file to get
ajax[index].onCompletion = function(){ createTownsResorts(index) }; // Specify function that will be executed after file has been found
ajax[index].runAJAX(); // Execute AJAX function
}
}