$(document).on('click', 'body', function (e) {
var div = $(".menu"),
checkbox = $('#menu-toogle'),
label = $('#menu-toogle + label');
if (!div.is(e.target)
&& div.has(e.target).length === 0
&& !checkbox.is(e.target)
&& !label.is(e.target)
) {
checkbox.prop('checked', false);
}
});
for (let i in users) {
for (let j in views) {
if (users[i].id === views[j].user_id) {
if (users[i].hasOwnProperty('page_views')) {
users[i].page_views += views[j].page_views;
users[i].clicks += views[j].clicks;
}
else {
users[i].page_views = views[j].page_views;
users[i].clicks = views[j].clicks;
}
}
}
}
$(document).on('click', '.clear-input', function() {
$(this).closest('.search').find('.input-class').val('');
});
$(document).on('click', '.radio', function() {
var itog = $('#itog'),
mult = $('#mult'),
$this = $(this),
multiplier = $('#company').find(':selected').val() * $this.data('year');
mult.val(multiplier);
itog.val(multiplier * (1 - $this.data('mult')));
});
<form id="year">
<input class="radio" type="radio" id="radio-1" name="group" data-year="1" data-mult="0"/>
<input class="radio" type="radio" id="radio-2" name="group" data-year="2" data-mult="0.15"/>
<input class="radio" type="radio" id="radio-3" name="group" data-year="3" data-mult="0.2"/>
<div class="company">
<select name="company" id="company">
<option value="1500">1</option>
<option value="5300">до 5</option>
<option value="10100">до 10</option>
<option value="12000">до 25</option>
<option value="17000">до 50</option>
<option value="0">50+</option>
</select>
</div><br>
<input type="label" id="mult" name="789" maxlength="300" readonly><br>
<input type="label" id="itog" name="789" maxlength="300" readonly>
</form>
<?php
$db = mysqli_connect("127.0.0.1", "root", "","main_t");
mysqli_set_charset($db,"utf8");
function getData()
{
$data = [
'cols' => [
[
'id' => '',
'label' => 'Кандидатов',
'type' => 'number'
],
[
'id' => '',
'label' => 'Эффективность',
'type' => 'number'
]
],
'rows' => []
];
$query = "SELECT `stars`,`age` FROM `main_t`";
$res = mysqli_query($db,$query);
while ($row = mysqli_fetch_assoc($res)) {
$data['rows'][] = [
'c' => [
['v' => $row['stars']],
['v' => $row['age']]
]
];
}
return json_encode($data);
}
$data = getData();
echo $data;
?>
if (isset($_POST["firstname"]) && isset($_POST["lastname"]) && isset($_POST["phone"]) && isset($_POST["email"]) ) {
$result = array(
'firstname' => $_POST["firstname"],
'lastname' => $_POST["lastname"],
'sex' => !empty($_POST["sex"]) ? <признак мужского пола> : <признак женского пола>,
'phone' => $_POST["phone"],
'email' => $_POST["email"]
);
echo json_encode($result);
}
?>
function showMiniCart() {
//показываю мини корзину
var out="", all_count = 0;
for (var key in cart) {
out += key +' --- '+ cart[key]+'';
all_count += cart[key];
}
$('.mini-cart').html(out);
$('<all_count_container>').html(all_count);
}