$json = '...';
$data = json_decode($json, true);
$comment = 77098646;
$results = array_filter($data['data'], function ($item) use ( $comment ) {
return $item['comment'] == $comment;
});
$status = $results ? 1 : 0;
$.ajax({
url: url,
cache: false,
});
$html = '....';
preg_match('@<script(?:[^>]*\stype="(?:application|text)/json")?[^>]*>(.*?)</script>@s', $html, $data);
$data = json_decode($data[1]);
print_r($data);
function getCookie(name) {
function escape(s) { return s.replace(/([.*+?\^${}()|\[\]\/\\])/g, '\\$1'); };
var match = document.cookie.match(RegExp('(?:^|;\\s*)' + escape(name) + '=([^;]*)'));
return match ? match[1] : null;
};
var cities = [{ "CityId": 781, "Name": "Санкт-Петербург", "RegionId": 58 }],
currentCity = cities.filter(function(data) {
var currentCityId = getCookie('CityId');
return data.CityId == currentCityId;
});
console.log(currentCity);