function popResorts(countryid) { $.getJSON('/new_ajax/homepage.php', {task: 'fillResorts', countryid: countryid} , function(data){ var options = ''; var len = data.length; for (var i = 0; i< len; i++) { options += ''; } $('select#listresort').html(options); }); } function popOffers(startDate, countryId) { $.getJSON('/new_ajax/homepage.php', {task: 'fillOffers', start_date: startDate, country_id: countryId} , function(data){ var len = data.length; var soleocc = ''; $("div#offers_list").html(''); if(len>0) { for (var i=0; iSki Deals ' + data[i].headingname + ''); else $("div#offers_list").append('

Deals ' + data[i].headingname + '

'); } else { if(data[i].soleocc=='y') { soleocc = ' *'; } else { soleocc = ''; } if(countryId!='') { $("div#offers_list").append('
Chalet sleeping ' + data[i].groupsize + ' - ' + data[i].depdate + ' - £' + data[i].price + soleocc + '
'); /*$("div#offers_list").append('
' + data[i].title + soleocc + '
');*/ } else { $("div#offers_list").append('
' + data[i].resortname + ' - ' + data[i].depdate + ' - £' + data[i].price + soleocc + '
'); /*$("div#offers_list").append('
' + data[i].title + soleocc + '
');*/ } } } } else { $("div#offers_list").append('

Sorry, there are no offers for your chosen travel options

'); } }); } $(window).load(function() { setTimeout(function(){ $('#slider').nivoSlider({ pauseTime:11000, directionNav:false, controlNav:false, effect:'fade', captionOpacity:1, pauseOnHover:false }); }, 1000); popResorts(''); popOffers($('select#offer_depdate').val(),$("select#offer_country").val()); }); $(function(){ $("select#listcountry").change(function(){ popResorts($(this).val()); }) }) $(function(){ $("select#offer_depdate").change(function(){ popOffers($(this).val(),$("select#offer_country").val()); }) }) $(function(){ $("select#offer_country").change(function(){ popOffers($("select#offer_depdate").val(),$(this).val()); }) })