无法调用 PersistJS 保存的数据
我有一个jquery变量,其中包含由ckeditor创建的如此多的格式化数据,并尝试将其传递到另一个页面而不重新加载,所以我使用ajax,但无法将此变量作为查询字符串传递,因为它有如此多的格式化数据,所以我正在尝试使用 PersistJS 来保存这个变量。保存它并在同一页面调用它没有问题,但当我测试它时出现问题。我有 2 个页面 page1 ,其中包含此代码
var proDetails = $('textarea.editor').val();
var store = new Persist.Store('My Data Store');
var data = proDetails;
store.set('saved_data', data);
page2 包含此代码
$(document).ready(function() {
store.get('saved_data', function(ok, val) {
if (ok)
alert('saved data = ' + val);
});
});
,但它不起作用,并且可以肯定我在两个页面中调用 persist-min.js 如果它不起作用,是否可以将 proDetails 变量保存在 php 会话中,以便我可以在其他页面中调用它?
i'm having a jquery variable containing so much formatted data created by ckeditor and trying to pass it to another page without reloading so i'm using ajax but can't pass this variable as a query string because it has so much formatted data so i'm trying to use PersistJS to save this variable. no problem with saving it and calling it back at the same page but the problem occurred when i was testing it. i have 2 pages page1 with this code
var proDetails = $('textarea.editor').val();
var store = new Persist.Store('My Data Store');
var data = proDetails;
store.set('saved_data', data);
page2 containing this code
$(document).ready(function() {
store.get('saved_data', function(ok, val) {
if (ok)
alert('saved data = ' + val);
});
});
but it doesn't work and for sure i'm calling the persist-min.js in both pages
and if it didn't work is there anyway to save the proDetails variable in a php session so i can call it in the other page ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您尚未初始化第 2 页上的
store
对象。You have not initialized
store
object on page 2.您可以通过 POST 发送这么长的数据字符串,而不会受到 GET 请求的大小限制。
请记住,如果您使用 PersistJS,这些数据将不会发送到您的服务器。
除此之外 juzerali 已经回复你了
You could send that long string of data through POST, which doesn't suffer the size limitation of a GET request.
Keep in mind that those data will not be sent to your server if you use PersistJS.
Other than that juzerali already replied to you