I have 2 php pages. Let's name it page1.php and page2.php. On page1.php is a textbox with the value of 0, and on page2.php is a button. Now these two pages are open in different tabs in a browser. What I want to happen is whenever the button in page2.php is clicked the textbox value in page1.php will change to 1. Note that I want this process to happen without redirecting or refreshing the pages.
page1.php
<script type="text/javascript" src="jscript.js">
<input type="text" value="0" id="txt1">
page2.php
<script type="text/javascript" src="jscript.js">
<input type="button" value="change text1 value" onClick="changeval()">
jscript.js
function changeval(){
document.getElementById('txt1').value="1";
}
I wanna change the value of textbox through it's id. My professors gave me a hint that this could be done using javascript/jquery or ajax. Any help would be much appreciated.