I had an interesting problem. I am currently developing a php page and you need to access the php variable in javascript onload.
$(document).ready(function() { var temp = <?php $page_id ?> }
Is this really so? I know this may seem strange and not allowed, but I am developing a page with two pop-ups. Windows are created using the same presentation template, and there is no way to distinguish each other. If I saved a hidden value on a page with information unique to that page, so
<input type="hidden" value="<?php $page_id ?> id="page_id" />
if two views open simultaneously, for me there is no way to get a unique page identifier
var temp = $("#page_id").val();
Because there are two views with the same input identifier, which is not unique. In short, is it proper to refer to a php variable in javascript?
source share