jquery-mobile - JQuery Mobile simpledialog 从页面中清除我的动态数据

标签 jquery-mobile

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/

相关文章:

javascript - jquery 移动弹出对话框 : Cannot read property 'is' of undefined

jquery-mobile - 更改 JQM 面板的宽度

javascript - 无法使用 jQuery Mobile 1.3.1 显示弹出窗口

javascript - 当我点击空白区域时,Jquery Mobile 出现奇怪的空间

android - 移动设备上的 iframe 支持

css - 单选按钮宽度

javascript - AngularJS + jQuery Mobile w/No Adapter & Disabled Routing - 仅用于 UI 样式

jquery-mobile - jQuery Mobile 中的可折叠内容

jQuery Mobile ListView 分页

user-interface - 如何在 jQuery Mobile 中使用页面加载来阻止 UI