how to pass data from one html page to second in php?

后端 未结 6 1592
南笙
南笙 2021-01-23 15:05

I have created a page for updation of record. I want to pass the id of student from one page to another. I am trying to send it through window.location but it is not working. In

6条回答
  •  孤城傲影
    2021-01-23 15:41

    If both pages are at same domain you can use localStorage, storage event to pass data between html documents

    At second page

    window.addEventListener("storage", function(e) {
      // do stuff at `storage` event
      var id = localStorage.getItem("id");
    });
    

    at first page

    // do stuff, set `localStorage.id`
    localStorage.setItem("id", "abc");
    

提交回复
热议问题