weixin_33736832 2017-12-29 14:49 采纳率: 0%
浏览 23

将PHP $ _POST传递给Ajax调用

I have a Page A that a user sets their filters on which then posts the data to a new tab for processing in an EventViewer tab (Page C). However, as the page takes a long time to process in some cases, I want to add a loader Page B in between, however, I am struggling to work out how to pass the $_POST data to an AJAX call to be made to PageC.

The flow is as follows:

  1. User enters filters on Page A
  2. PageA posts data to a new tab Page B (Loader with a spinner page)
  3. When on Page B an AJAX call is made to load the actual data from Page C in the background by passing the data originally set in Page A.

Please help! Or suggest better ways of doing this flow.

  • 写回答

1条回答 默认 最新

  • 程序go 2017-12-29 15:20
    关注

    You can't access browserside the $_POST variables.

    Read the textboxes with jquery/Javascript, and then make an ajax request to the other page with your (in js-vars saved) POST-Parameter.

    https://www.w3schools.com/jquery/jquery_ajax_get_post.asp

    So: pass the parameter to PageB, make in PageB an ajax request to pageC, which just returns the data, then display the data in in PageB, as soon they are returned.

    That you have access to the parameters from PageA in PageB:

    var Test = <?php echo $_POST["test"]; ?>;
    
    评论

报告相同问题?

悬赏问题

  • ¥15 我想在一个软件里添加一个优惠弹窗,应该怎么写代码
  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流