Swipe
Новичок
Господа,не обрабатывается скрипт на покупку
При нажатие на кнопку "ок" ничего не происходит.

При нажатие на кнопку "ок" ничего не происходит.
Код:
<script>
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
function buy(id) {
swal({
title: 'Ввод данных',
html: '<input id="email" name="email" placeholder="Email"> <input id="count" name="count" placeholder="Кол-во"> <input id="cupon" name="cupon" placeholder="Купон"><? if (config_item('site_pwebmoney') == '1') { ?><label class="" title="WMR" > <input type="radio" id="fund" name="fund" value="1" /> <img src="http://i.imgur.com/xzHmsvU.png"> </label><? } ?><? if (config_item('site_pqiwi') == '1') { ?><label class="" title="Qiwi" > <input type="radio" id="fund" name="fund" value="4" /> <img src="http://i.imgur.com/psm0I7B.png"> </label><? } ?><? if (config_item('site_pyandex') == '1') { ?><label class="" title="Yandex"> <input type="radio" name="fund" id="fund" value="3" /> <img src="http://i.imgur.com/H4F9ZdY.png"> </label> <? } ?><? if (config_item('site_pkassa') == '1') { ?><label class="" title="Free-kassa"> <input type="radio" name="fund" id="fund" value="5" /> <img src="http://i.imgur.com/e3THVhq.png"> </label><? } ?><? if (config_item('ik_status') == '1') { ?><label class="" title="Interkassa"> <input type="radio" name="fund" id="fund" value="6" /> <img src="http://i.imgur.com/qSI6kAf.png"> </label><? } ?><? if (config_item('pr_status') == '1') { ?><label class="" title="Payeer"> <input type="radio" name="fund" id="fund" value="7" /> <img src="http://i.imgur.com/zCqJhzz.png"> </label><? } ?><? if (config_item('rk_status') == '1') { ?><label class="" title="Robokassa"> <input type="radio" name="fund" id="fund" value="8" /> <img src="http://i.imgur.com/dwFVoTD.png"> </label><? } ?>',
showCancelButton: true,
closeOnConfirm: false,
allowEscapeKey: false,
allowOutsideClick: false
}).then(function(isConfirm) {
if (isConfirm) {
var email = $('#email').val();
var count = $('#count').val() || 0;
var cupon = $('#cupon').val();
var fund = $('input[name="fund"]:checked').val();
if (!validateEmail(email)) {
swal("Ошибка!", 'Указан неверный email адрес ', "error");
return false;
}
document.getElementById('loadImg').style.display = 'block';
$.post("/order/", {
email: email,
count: count,
type: id,
fund: fund,
cupon: cupon
},
function(data) {
document.getElementById('loadImg').style.display = 'none';
try {
var res = JSON.parse(data);
if (res.ok == 'TRUE') {
window.location.href = "/oplata"
}
if (typeof(res.error) !== "undefined" && res.error !== null) {
showerr(res.error);
}
} catch (err) {
eval(data);
}
});
}
})
}
</script>