【发布时间】:2014-01-06 19:04:04
【问题描述】:
我有我的 index.php 并加载让我们用 .load() 将“content.php”加载到窗口 onload 上的 div 中。
如何在我的 index.php 中使用 content.php 中的变量
例如:
假设我的 content.php 中有一个名为 $something 的变量。我想在我的 index.php 中使用该变量
在我的 index.php 中:
<head>
$(function Loadcontent() {
$("#content").load("content.php")
});
window.onLoad = Loadcontent();
</head>
<body>
<div id="content"></div>
</body>
在我的 content.php 文件中,我现在声明一个变量:
$something = 1;
我现在想在 index.php 中使用 $something
【问题讨论】:
-
显示一些代码将有助于回答。
-
你使用 AJAX。
-
不能,index.php已经被服务器渲染好了。
-
我添加了一些伪代码。又快又脏。
-
你能给我举个eisa adil的例子吗?
标签: php jquery variables load return