'; g += '
'; }else{ g = ''; } g += '
'; g += ''; g += '
'; g += '
'; $(".buy-games").append(g); }); }else if(go=="loc"){ $("#select_0").empty(); $.each(da, function (index, data) { parse_data['locs'][data.id] = data; $("#select_0").append(''); }); }else if(go=="rate"){ cpu = parse_data['locs'][$('#select_0').val()]['cpu']; $('#select_proc').css('width', cpu+'%'); $('#select_proc').removeClass('progress-bar-success'); $('#select_proc').removeClass('progress-bar-info'); $('#select_proc').removeClass('progress-bar-warning'); $('#select_proc').removeClass('progress-bar-danger'); if(cpu'60'){$('#select_proc').addClass('progress-bar-warning');} if(cpu>'80'){$('#select_proc').addClass('progress-bar-danger');} $("#select_1").empty(); parse_data['rates'] = []; $.each(da, function (index, data) { parse_data['rates'][data.id] = data; parse_data['vers'][data.id] = data.vers; $("#select_1").append(''); }); }else if(go=="slots"){ $("#select_2").empty(); rate = $('#select_1').val(); $('#select_support').empty().append(''); if(parse_data['rates'][rate]['support']!="0"){ $('#select_support').append(''); } var count = parse_data['rates'][rate]['min_slots']; var count2 = parse_data['rates'][rate]['max_slots']; while(count++'+count+''); } buy_price(); }else{ buy_price(); } buy_time = setTimeout(function() {buy(1)},100); } function buy_load(go){ if(buy_first==1){ $('#loader-ajax').css('display','block'); pre_load_on(); buy_first=0; } $.ajax({ url: '/servers/buy/load', dataType: 'json', type: "POST", data: { 'ajax_f': '1', 'go':go, 'game':buy_data['game'], 'loc':buy_data['loc'], 'rate':buy_data['rate'] }, success: function(data){ if(data.e){ ajax_result(data); buy_go('error'); pre_load_off(); $('#loader-ajax').css('display','none'); }else{ buy_go(go,data); } } }); } $(document).ready(function(){ buy_data = []; parse_data = []; clearTimeout(buy_time); buy_first= 0; pre_load_on(); $(".sum").css('display','none'); $(".sum-error").css('display','none'); if(!mett){ $('.timed-text').empty().append('Оплатить до:'); $('.timed-form').empty().append(''); }else{ var times = ""; $.each(mett_price, function (index, data) { if(data.price1){ times += ''; }else{ if(data.price2) { times += ''; }else{ times += ''; } } }); $('.timed-text').empty().append('Оплатить на:'); $('.timed-form').empty().append(''); } $('#loader-ajax').css('display','block'); buy(1); $('.date-picker').datepicker({ orientation: "left", autoclose: true, format: 'dd-mm-yyyy', startDate: '17-03-2016', endDate: '11-03-2017' }); $(document).off("click", ".cupon-check"); $(document).on("click", ".cupon-check", function (e) { e.preventDefault(); cupon2 = $('input[name="data[cupon]"]').val(); $.ajax({ url: '/servers/buy/cupon', dataType: 'json', type: "POST", data: { 'ajax_f': '1', 'cupon': cupon2 }, success: function (data) { if (data.e) { cupon = []; ajax_result(data); buy_price(); } else { cupon['sum'] = data.sum; cupon['type']= data.type; cupon['min']= data.min; buy_price(); } } }); }); });