똑같은 삽질은 2번 하지 말자
PHP 에서 JSON으로 넘겨 javscript에서 받기 본문
xxx.php
public function toJSON()
{
return $this->toISOString();
}
// 이하의 형태로 넘김
'xxx' => xxx -> toJSON()
어디든 스크립트 코드가 되는곳,,
<script>
const xxxData = JSON.parse(<?= json_encode($xxx); ?>)
</script>
Comments