I need to pass the version no to javascript from php. But i dont want to use ajax.
$(document).ready(function(){
init();
})
<body>
...
<input type="hidden" id="version" value="<?php echo $version; ?>
....
<script>
function init() {
version = $('#version').val();
}
</script>
Can i do in this way? Or, should i use ajax?
如果这样做,则无需将其放入隐藏的输入中:
const version = "<?php echo $version; ?>";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.