我正在开发一个基于 jquery Mobile 的项目。我是这个领域的大人物,很抱歉这个愚蠢的问题。问题是——我有一个页面'Page1',我正在使用 post 方法从数据库中获取数据。成功后,我通过通知对话框向用户显示通知(没有取消和确定按钮)。现在我想要在另一个页面“page2”上显示这条成功消息,并且该消息应该存在长达 2 秒,然后自动消失。我努力了
function sendAddGuest(data, dialog) {
$.post("/GuestsList/AddGuest", data, function (response) { //using the post method
//alert(JSON.stringify(response));
$('.error').html("");
hideLoading();
if (response.result == 'success') { //if the process done
$.mobile.changePage('/GuestsList/Index', { dataUrl: "/GuestsList/Index", reloadPage: false, changeHash: true }); //To another page "page2"
// window.setTimeout('showToastMessage("Guest added successfully with window");',2000); //i have tried this
setTimeout(function () { showToastMessage("Guest added successfully test2"); }, 100); //and this also i want to show this message on other page "page2"
}
}