Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我碰巧在我的网络应用程序上有一个功能,可以将数据保存到本地存储中,然后我将其转换为 json 对象。有没有办法让我使用 ajax 将本地存储数据传递到我的服务器。我想让我的网络应用程序的其他客户端访问该数据。
您可以像传递任何其他参数一样传递localStorage值,如下所示:ajax
localStorage
ajax
// jQuery ajax call. $.ajax({ url: "test.html?jsonValue=" + localStorage.getItem("foo"), });
没有localStorage像 for 那样传递值的特殊方法cookies。
cookies