Refresh the page between the mobile terminal

From page A to page B issues need to refresh the data.

For example, after a successful save data A page B need to jump to the page. Intermediate use Ajax.

  1. First, the success of Ajax to save data A place settings page:
    1  sessionStorage.setItem("need-refresh", true);
    sessionStorage: Create a local store, it is in the form of key-value pairs.
  2. In the B page
    1  $(document).ready(function (e) {
    2        window.addEventListener("pageshow", function () {
    3             if (sessionStorage.getItem("need-refresh")) {
    4                 location.reload();
    5                 sessionStorage.removeItem("need-refresh");
    6             }
    7         });
    8 });

     

Guess you like

Origin www.cnblogs.com/LBJLAKERS/p/11302597.html