Javascript Html/PHP视图控制器:如何仅刷新页面的一部分
我有一个文件controller.php,它管理我的网站不同opage的加载 例如,由于控制器的index()函数,主页面被加载,这要归功于以下函数:Javascript Html/PHP视图控制器:如何仅刷新页面的一部分,javascript,php,jquery,html,Javascript,Php,Jquery,Html,我有一个文件controller.php,它管理我的网站不同opage的加载 例如,由于控制器的index()函数,主页面被加载,这要归功于以下函数: public function index() { $results = array(); // Some SQL stuffs here to fill the array here… $this->registry->template->results = $results; $this-&g
public function index() {
$results = array();
// Some SQL stuffs here to fill the array here…
$this->registry->template->results = $results;
$this->registry->template->show(‘indexView'); // load the web page
}
在我的indexView.php文件中,我得到了如下内容:
<div class="row">
<?php foreach ($results as $domain) {
echo "<h3>".$domain[ "price"]. "</h3> ;
} ?></div>
您应该使用ajax请求。您应该使用[ajax][1]。[1] :您是否使用任何JS框架?在这种情况下,我使用,用于请求数据并适当更新页面…您应该使用ajax请求。您应该使用[ajax][1]。[1] :您是否使用任何JS框架?我在这种情况下使用,用于请求数据并适当更新页面。。。
<form method='POST' onsubmit='javascript:goSearch();return false;'>