.hide("explode", {}, 1000);
$(".main-head").on("click", "#next", function(e) {
e.preventDefault();
var template = $("#slider").html(),
id = $(".main-head .id").data('id'),
countdown = $(this).find('a.count'),
cur_count = countdown.data("count"),
slides_count = $('.main-head').data('slides');
$(".main-head .covered").fadeOut(1000, function() {
$.post("/gtc/next", { id: id }, function(resp) {
$(".main-head").html(_.template(template, { item:resp }));
$(".main-head").find('a.count')
.text(cur_count+1+"/"+slides_count)
.data('count', cur_count+1)
.attr('count', cur_count+1);
$(".main-head .covered").fadeIn(1000);
});
});
});
{
"new":"asdsa",
"list":
[
{
"name":"first",
"rating":"50%",
"story":"Once upon a time"
},
{
"name":"second",
"rating":"65%",
"story":"New chapter"
}
]
}
$.getJSON('data.json', function(data){
console.log(data);
});
var snake = {
interval : {
interval_id: null,
right : function (stop){
if (stop) {
return clearInterval(this.interval_id);
}
if (this.interval_id) {
clearInterval(this.interval_id);
}
this.interval_id = setInterval(snake.functions.moveRight, 500);
}
}
}
snake.interval.right();
snake.interval.right(true);
addEvent : function(id, hadler, type) {
addEvent : function(id, handler, type) {
function renderTpl($tpl, $data) {
return preg_replace_callback(
"@\{(.+?)\}@",
function($matches) use ($data) {
return isset($data[$matches[1]]) ? $data[$matches[1]] : "";
},
$tpl
);
}
$template = "Hello {first_name} {last_name}!!!";
$data = array(
"first_name" => "John",
"last_name" => "Doe"
);
echo renderTpl($template, $data); //Hello John Doe!!!
if (empty($useremail)) {
echo 'Введите Вашу почту';
} elseif (!filter_var($useremail,FILTER_VALIDATE_EMAIL)) {
echo 'Не правильно введен E-mail';
} elseif (strlen($useremail) > 0) {
$query = sprintf("SELECT user_email FROM users WHERE user_email = '%s' LIMIT 1",mysqli_real_escape_string($link,$useremail));
$result = mysqli_query($link, $query);
if (mysqli_num_rows($result) == 1) {
echo 'Такой E-mail уже занят. <a href="/?do=lost">Восстановить пароль?</a>';
} elseif (empty($username)) {
echo 'Введите Ваше имя';
} elseif (strlen($username) < 2 ) {
echo 'Имя должно быть более 2 букв';
}
}