在该部分工作,我使用localstorage加载页面,但我有点困惑,因为我想传递自定义消息显示
到目前为止我的用法:
success: function(data) {
if ($.trim(data) == 'Complete') {
localStorage.setItem("Success","Thanks this is complete")
location.href = 'index';
}
并在顶部我有这个:文件准备好后
if(localStorage.getItem("Success"))
{
$(".msg").html(data); - data i want the message to be appearing which i defined in the localStorage.setItem("Success","Thanks this is complete")
localStorage.clear();
}
答案 0 :(得分:1)
使用本地存储中的get方法应该可以解决问题 localStorage.getItem(“成功”)
if(localStorage.getItem("Success"))
{
$(".msg").html(localStorage.getItem("Success") );
localStorage.clear();
}
LocalStorage是窗口属性而不是jquery函数....