简体   繁体   English

PHP标头包含AJAX加载的页面?

[英]PHP header with AJAX loaded pages?

I currently have it set up so that to navigate to various pages you click links on index.php, which then load into the content box of index.php. 我目前已对其进行设置,以便导航到各个页面,单击index.php上的链接,然后将其加载到index.php的内容框中。

I currently have a form on one of those pages that once submitted, I would like to redirect to the index.php page. 我目前在提交的那些页面之一上有一个表单,我想重定向到index.php页面。 But instead of displaying the default content on index.php, I'd like to specify the page loaded into the content box. 但是,我不想在index.php上显示默认内容,而是要指定加载到内容框中的页面。

Is there a way to do this using a header? 有没有一种方法可以使用标题? eg. 例如。 header('Location: index.php#<contentboxpagehere>'); ?? ??

Thanks! 谢谢!

So if I have understood correctly, you have a form and after a successful submission you want to redirect to the front page and display the right output message with an AJAX call in your defined page container. 因此,如果我正确理解,您将拥有一个表单,并且在成功提交之后,您想要重定向到首页并在定义的页面容器中显示正确的输出消息以及AJAX调用。

You can achieve that in many ways. 您可以通过多种方式实现这一目标。 Keeping it simple and PHP you can do that with either a POST or GET request on the index page passing the container id you want to call in your front page AJAX container. 保持简洁和PHP,您可以通过在索引页面上执行POST或GET请求,在您的首页AJAX容器中传递要调用的容器ID来实现。

Using GET, pass URL parameter like: index.php?cbpId=success 使用GET,传递URL参数,例如:index.php?cbpId = success

Get the $_GET['cbpId'] and load the right content on the front page. 获取$ _GET ['cbpId']并在首页上加载正确的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM