<td class="sr-page__list__item_img">
<? if( $v['imgs'] ): ?>
<span class="rel inlblk">
<a title="<?= $v['title'] ?>" href="<?= $v['link'] ?>" class="thumb stack rel inlblk">
<img alt="<?= $v['title'] ?>" src="<?= $v['img_s'] ?>" class="rel br2 zi3 shadow" />
<? if( $v['imgs'] > 1 ): ?>
<span class="abs border b2 shadow"> </span>
<span class="abs border r2 shadow"> </span>
<? endif; ?>
<? else: ?>
<img class="rel br2 zi3 shadow" src="def-m.png" alt="Алиса">
</a>
</span>
<? endif; ?>
</td>
function getFormData($method) {
// GET или POST: данные возвращаем как есть
if ($method === 'GET') return $_GET;
if ($method === 'POST') return $_POST;
// PUT, PATCH или DELETE
$data = array();
$exploded = explode('&', file_get_contents('php://input'));
foreach($exploded as $pair) {
$item = explode('=', $pair);
if (count($item) == 2) {
$data[urldecode($item[0])] = urldecode($item[1]);
}
}
return $data;
}
<form action="#" id="test">
<input type="date" name="date">
<input type="number" name="num">
<input type="submit">
</form>
$(function(){
$('#test').on('submit', function(){
let data = $(this).serialize();
$.ajax({
method: 'POST',
url: 'test.php',
data: data
}).done(function( msg ){
console.log( msg );
});
return false;
});
});
$file = file_get_contents('data.json');
$list = json_decode($file,TRUE);
unset($file);
$list[] = [ $_POST['date'], $_POST['num'] ];
file_put_contents('data.json',json_encode($list));
$dom = new DOMDocument(1, "UTF-8");
@$dom->loadHTML($html);
$body = $dom->getElementsByTagName('body')[0];
$new_html = '';
foreach ($body->childNodes as $node)
{
if( $node->nodeName === '#text' ){
$new_html .= $node->textContent;
}else{
$new_html .= '<'.$node->nodeName.'>'.$node->textContent.'</'.$node->nodeName.'>';
}
}