zorza zorza - 9 months ago 47
Javascript Question

jQuery open page in a new tab while passing POST data

I have a javascript variable called "list". I need to send it as a POST data to another page and open that page in a new tab (with the POST data present).

This code:

jQuery.post('datadestination.php', list);

sends the data all right, but ofcourse it opens the page in the same tab.

I saw some solutions to similar problems using invisible form and things like that, but I could not get them to work. Is there any simple solution?

Answer Source

1) Why not to pass that list with the jquery.post() function and save it in the SESSION array;

2) Then open a new tab with the same file/address/url with the window.open() function;

3) Retrieve saved data from the SESSION array;

Seems a straightforward and clean way?