I have an index.php. It has a log in function. Let's say I have 2 users A and B.
Page1(index.php of user A) -with function(checks whether there are changes in the database, if yes: alert('message'))
Page2(index.php of user B) -with button which when clicked should update the database
I can already update the database, the function from page1 already works, it can detect changes, but only when you reload it. So I want to reload Page1 whenever page2 updates the database. I thought of just using setTimeout(something, timeInterval) in Page1 but it doesn't seem appropriate since the components of Page1 are flickering everytime it reloads. I want Page1 to reload if and only if there are changes in my database. I also thought of just putting the Page1's function inside an infinite while loop but it doesn't seem appropriate either, since the page just loads..
Another thing is, I was informed about JSON and REST. So I could just access the database from the script file. But I'm not that knowledgeable in it. Neither am I in jQuery.
I've tried searching about refreshing a page from another but the answers I found were either vague or difficult for me. And my pages have the same name, they only differ with the user logged in. But If I can find a way to do this, then I'll just do something with my pages' names.
Is there any other way I can do this? Thank you.