JQuery Mobile simpledialog() 从页面中清除我的动态数据。
实际上我有一个列表,我正在使用 simpledialog 从中删除记录
迅速的。但这将清除我动态生成的列表,因此我必须重新加载
返回列表的页面。有没有办法摆脱这个。
下面是我的代码:
$('#Delete').simpledialog({
'mode': 'bool',
'prompt': 'Are you sure to deactivate'?',
'useModal': true,
'buttons': {
'OK': {
click: function () {
$('#dialogoutput').text('OK');
$.ajax({
type: 'POST',
url: deactivateUrl,
data: { postVar: postDeactivate },
beforeSend: function () {
showPageLoading("De-Activating..");
},
success: function (data) {
hidePageLoading();
if (data = 'true') {
notification("Record Deactivated!");
location.reload();
}
else {
notification("Deactivation failed.");
}
},
error: function () {
//alert("Error");
}
});
}
},
'Cancel': {
click: function () {
$('#dialogoutput').text('Cancel');
location.reload();
},
icon: "delete",
theme: "c"
}
}
});
最佳答案
你有,
if (data = 'true') {
notification("Record Deactivated!");
location.reload();
}
else
{
notification("Deactivation failed.");
}
这个:
if (data = 'true')
威尔总是 为“真”,因为您使用单个等号将其设置为“真”。
也许你想要:
if (data == 'true')
或者
if (data === true)
关于jquery-mobile - JQuery Mobile simpledialog 从页面中清除我的动态数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13231049/