快速问题,为什么这不起作用?使用javascript显示内容
if (xmlhttp.responseText)
{
location.href = "result.php"
document.getElementById('page-result').innerHTML = xmlhttp.responseText;
}
我想要做的是把搜索结果放在另一页的div上。
快速问题,为什么这不起作用?使用javascript显示内容
if (xmlhttp.responseText)
{
location.href = "result.php"
document.getElementById('page-result').innerHTML = xmlhttp.responseText;
}
我想要做的是把搜索结果放在另一页的div上。
重定向到在查询字符串类似的消息传递你的下一个页面...
if (xmlhttp.responseText)
{
location.href = "result.php?responseText=" + encodeURIComponent(xmlhttp.responseText);
}
在result.php,输出参数“responseText的”不管你想要的内容。
ex。在php中:<?php echo $_GET["responseText"]; ?>
每个HTML页面是独立的;浏览器从每页上的干净页面开始,所以你不能像这样操纵上一页中的下一页的DOM。您必须使用GET或POST(或Cookie或会话或...)将信息传递到下一页,并在那里单独处理信息。
这不是jQuery。 – JJJ 2012-07-23 14:25:40
Juhana说,这不是jQuery。这是标准的JavaScript。如果你想要jQuery ajax:http://api.jquery.com/jQuery.ajax/ – Drakkainen 2012-07-23 14:27:53