Session Storage in js

前端 未结 3 1014
死守一世寂寞
死守一世寂寞 2021-02-14 18:06

Hi i\'m a beginner in JavaScript i would like to ask if its possible to session the data i\'m getting from a server. The data i want to session is the \'data.xhr.response\' i se

3条回答
  •  难免孤独
    2021-02-14 18:51

    Try reading this article about session storage on mozilla.org, it shows how straightforward it is. In your case it should be as simple as:

    $('#file-upload').dropzone({
      maxFiles: 1,
      acceptedFiles: ".pdf,.doc,.docx,.html", 
      dataType: "json",
      success : function(data) {
          sessionStorage.setItem('xhr', data.xhr.response);
      }
    });
    

提交回复
热议问题