I am trying to send MY location to my js file. The location have the gives correct value when it is echoed from php. But when i try to access it from my js it does not access the correct value instead contains the value `<?php echo $location;?>` well how can i access the value in js?
PHP
whi
我已经用Mobile_Detect.php构建了一个移动检测,它工作得很好。现在,如果用户不想停留在移动网站上,他可以点击“桌面版”,并通过设置$_SESSION['mobile'] = 'off'的“mobile_off.php”返回主页。
主站点执行以下代码:
<?php
session_start();
// Did the User come back from mobile.php?
if ($_SESSION['mobile'] != 'off') {
include 'Mobile_
如何在带有echo函数的javascript中从外部php文件中定义变量?
我们有theconfigfile.php,thejsfile.js和thephpfile.php.
在theconfigfile.php中我们有:
<?php
$path = 'http://example.com/home.php'; // Set your path
?>
在thejsfile.js中有:
...
if (confirm("Are you sure you want to delete")) {
$.ajax({