How to pass javascript object from one page to other

前端 未结 7 1633
时光说笑
时光说笑 2020-11-27 07:27

I want to pass javascript object from one page to other page so anyone can tell me how to do it?

Is that possible to do so using jQuery?

7条回答
  •  借酒劲吻你
    2020-11-27 07:30

    I believe that the only way to pass a javascript object from one page to another is to serialize it into string and pass it in url. For example if you have object

    var temp = { id: 1, value: 'test' }
    

    you may want to use JSON-js to serialize it and pass it in for example http://mysite.com/?data=serialization. Then after you load the page you need to deserialize it via for example $.parseJSON().

提交回复
热议问题