javascript - Passing PHP $_POST to Ajax Call


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.




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.

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"]; ?>;

People are also looking for solutions to the problem: php - Is it proper form to use an image for a button tag within a form tag


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.