0
基本上,我想通過ajax在外部Js文件中使用php variavle。例如:如何在ajax的外部JavaScript文件中使用php變量?
在使用example.php文件<?php
$a="123"
//and then I want to call a show() function through a onclick event later
<xxxxxxxxxxxxx...... onclick="show()">;
?>
在另一個example2.js
文件中,有一個功能
show()
{
var b
// I want to assign $a's value to this variable b here.=> b=a
//but I only want to do this way by using ajax.
}
有沒有人能告訴我該怎麼做?謝謝。