刷新div而不刷新页面
我正在进行设置过程以设置数据库. 我试图让用户不刷新页面就经历所有阶段. 我被困在我想使用.load()jQuery函数的地方. 这是javascript:
i'm making a setup process to setup a db. I'm trying to let the user go through all the phases without refreshing the page. I'm stuck at a point where i want to use the .load() jquery function. This is the javascript:
if(response.error == 'none')
$("#setup_form").slideToggle('fast', function() {
$('#setup_form').load('./includes/db_setup_form.php');
$("#setup_form").delay(1000).slideToggle('fast');
});
if正在检查上一步设置是否一切正常.
The if is checking that everything went ok with the previous setup phase.
db_setup_form.php的工作方式如下:
db_setup_form.php works like this:
<?php if ($_SESSION['setup_progress'] == NULL) {?>
Starting phase
<?php }
else {
switch ($_SESSION['setup_progress'])
{
case "1":?>
phase 1
<?php break;
case "2":?>
phase 2
<?php break;
}
} ?>
这是主页:
<div id="setup_form">
<?php include('./includes/db_setup_form.php'); ?>
</div>
在用户完成第一个设置阶段后,将给出$ _SESSION ['setup_progress']变量. 问题是,如果在第一个安装阶段完成后手动刷新页面但javascript似乎不起作用,则div会显示,而没有更新的信息.
The $_SESSION['setup_progress'] variable is given after the user completes the first setup phase. The problem is that everything works if i manually refresh the page once the first installation phase is done but the javascript does not seem to work, the div gets displayed without the updated informations.
谢谢 据我所知一切应该没事...但事实并非如此.
thanks From what i know everything should be ok...but it is not.
您应提供有效的url而不是路径.所以:
you should provide a valid url instead of a path. So:
.load('./includes/db_setup_form.php');
应该是
.load('/includes/db_setup_form.php');