从 .load() 页面访问变量


Accessing variables from .load() page

我有我的索引.php,让我们在窗口加载时用.load()加载"content.php"到div中。
如何在索引中使用内容中的变量.php.php

例如:
假设我的内容中有一个名为 $something 的变量.php。我想在我的索引中使用该变量.php

在我的索引中.php:

<head>
$(function Loadcontent() {
    $("#content").load("content.php")
});
window.onLoad = Loadcontent();
</head>
<body>
<div id="content"></div>
</body>

在我的内容.php文件中,我现在声明了一个变量:

$something = 1;

我现在想在索引中使用$something.php

为此,

你需要使用Ajax,网络上有很多

http://www.w3schools.com/php/php_ajax_database.asp