我正在使用Jquery Toastr来显示一些成功消息。它就像是在一段时间内弹出警告框。
我想在页面重新加载后显示一些消息,但问题是当页面重新加载时,所有的JavaScript都会重新加载。
有没有办法解决这个问题?我想在ajax成功后实现这个功能。
success: function(data) {
if (data.OperationStatus) {
window.location.reload(); //Reload the page
Toaster.show("The record is added"); //I want to show here.But it will never show because when page is loaded javascript is also loaded.
}
}
有没有更有效的方法来做这件事?
localStorage
中维护状态,并从localStorage
中获取状态。如果成功获取状态,则显示toast提示。 - Parth Trivedilocalstorage
的获取和设置值,如果您遇到问题,请在此处写下。 - Parth Trivedi