Solution 1 :

You can put the response into localStorage via localStorage.setItem('objectName', objectValue);. Then, you can redirect to the Investigation.html page and use localStorage.getItem('objectName'); to get the value you were looking for.

Problem :

I have two HTML files:
Report.html and Investigation.html

Report.html has this button

<div>
<input id="InvestigateALF" type="submit" value="Investigate" onclick = "InvestigateALF()">
</div>

On click of this button, I will call a javascript function which will retrieve some data in JSON format from the back-end.
I want to populate this data on the drop which is in Investigation.html page

Investigation.html

<select id="Problem" class="browser-default custom-select">
    <option value="">-- Select --</option>
</select>

How do I send the response from javascript to that Investigation.html page?

Comments

Comment posted by mr. pc_coder

One way is to save in localStorage. In that page read from localStorage

Comment posted by Aseem Sarvapriya

okay but do I need to have the same JavaScript file for both HTML? Currently i was making two different JavaScript for them

Comment posted by BubbleMaster

No, you do not need to have the same JS file for both HTML files. You can keep the two different JS files. Please upvote and accept my answer if you found it helpful.

Comment posted by Aseem Sarvapriya

okay thanks ! but how can i use the getItem() function on the second JavaScript without any action. I mean the only action is the button click on the first html page. Can you help me with a small example maybe

By