Jquery load() and PHP variables

前端 未结 6 855
死守一世寂寞
死守一世寂寞 2020-12-03 00:29

If I load a PHP page with Jquery .load(file.php), can the included file use the php variables that were defined on the page that called the load()?

6条回答
  •  猫巷女王i
    2020-12-03 00:56

    variables scope in the PHP script loaded by JavaScript is different from the page that loaded the PHP script, so the answer is no.

    but you can define global variables or use super global variables like ($_GET, $_POST, etc.) to get what you want.

提交回复
热议问题