PHP按钮单击不重新加载页面
我有button.php,这段代码在button.php中PHP按钮单击不重新加载页面,php,jquery,ajax,Php,Jquery,Ajax,我有button.php,这段代码在button.php中 <a href="Cancel.php<button type="button">Cancel</button></a> 我有Cancel.php <?php //Do something header("location:button.php") ?> 当我点击Cancel按钮时,它应该处理一些东西并返回到相同的PHP
<a href="Cancel.php<button type="button">Cancel</button></a>
我有Cancel.php
<?php
//Do something
header("location:button.php")
?>
当我点击Cancel按钮时,它应该处理一些东西并返回到相同的PHP文件。
它会返回,但不会重新加载或更新页面内容。
是否有重新加载的方法,或者我的编码方法是错误的?我可以在这里使用jQuery吗?请帮帮我 使用标题(“刷新:0”)代码>
您必须添加简单的超链接,如下所示:
<?php
<a href="Cancel.php">Cancel</a>
?>
您可以使用JS
<a href="#" onClick="window.location.reload();return false;">Cancel</a>
在PHP中
<a href="Cancel.php>Cancel</a>
那不可能是你的代码。请发布您的实际代码。删除这么少的代码,这么多的错误:/No我想回到button.php并重新加载!当按钮被点击时!或者直接使用
Yha,它正在工作!好帮手!我已经搜索了很长时间。@Learn M_P_C nice确保将其作为答案检查,如果这有帮助,您需要添加echo
以呈现hyperlink
,因为它位于php标记中。
<button type="button" onclick="location.href='Cancel.php';">Cancel</button>
<a href="#" onClick="window.location.reload();return false;">Cancel</a>
<a href="Cancel.php>Cancel</a>