Is there a way to share a template/markup with the JSON API so that it doesn’t need to be declared both in PHP and in JS?

Is there a way to share a template/markup with the JSON API so that it doesn’t need to be declared both in PHP and in JS?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)