Solution 1 :

If there is no server-side involved, you can save the data using
Window.localStorage (check if browser compatibility is OK for you)

 $.ajax({
         type: "POST",
         url: "drilldown.html",
         data:data,
        success: function(response){
          localStorage.setItem('myData', data);
          window.location.href = 'drilldown.html'; // want to post the data this in redirection
      }
});

On the drilldown.html page, you can read the data with JavaScript by

var data = localStorage.getItem('myData');

There’s also sessionStorage which will be cleaned up after browser restart.

Problem :

I have ajax call and pull the data and I want to send the response to next page in ajax success and get the data in drilldown.html

 $.ajax({
         type: "POST",
         url: "drilldown.php",
         data:data,
        success: function(response){
          window.location.href = 'drilldown.php'; // want to post the data this in redirection
      }
});

Comments

Comment posted by Hobroker

The only way I see this is by adding the response data as a query parameter to your URL

Comment posted by user3386779

Is it possible in post call

Comment posted by Romi Halasz

If your ajax url is the same as the location you want to redirect, why not go there directly? There seems to be a problem with your flow. You send an ajax request to drilldown, and then redirect the user to drilldown.

Comment posted by stackoverflow.com/questions/8389646/…

It is possible, check this answer

Comment posted by Hobroker

I agree with @RomiHalasz, maybe rethink your flow?

By

Leave a Reply

Your email address will not be published. Required fields are marked *