1

I have a page with a button to create a simple report. On click of the button, it calls the back-end program to get the relevant data in a JSON format.

  1. Upon receiving the data I want to load the following page in a new window/tab,
  2. Load a fragment of the HTML maintained in a separate html,
  3. Place it in , and
  4. Plug the values received from back-end.

If I use window.open("Mypage.html"), it loads the page and shows it in new tab, but then I cannot use $("#report").load("fragment.html") and also I cannot replace values of that fragment.html.

How to solve this problem?

------------------------------
Mypage.html
------------------------------
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
</head>

<body>
    <div id="report"></div>
</body>
</html>

--------------------------
fragment.html
--------------------------

<h1>Sample Report</h1>
<h1>name</h1>
<p>Address</p>

1 Answers1

0

You could store the html fragment and json data in the browser's local storage. The first and second page both have access to the same local storage as long as the pages are served from the same origin (server ip and port). Checkout Shared variable scope between two browser tabs? [duplicate].

Dylan Landry
  • 1,150
  • 11
  • 27