使用ASP.net MVC Core将location.reload添加到特定的Tab

时间:2017-07-28 08:10:37

标签: javascript asp.net-mvc asp.net-core-mvc asp.net-ajax bootstrap-modal

我有一个页面,它使用bootstrap加载由TAB分隔的多个表。

在名为patient tab的第三个标签中,我在一个模态中完成了一个动作。

视图中的ajax调用将在控制器中调用一个动作,当逻辑成功返回到视图时,它会调用一个警告框并在表中加载最新的结果集,我把location.reload()函数但是,该页面在第一个TAB中返回或加载,而不是在我执行某些操作的第3个页面中。

我可以指定或强制加载Tab吗?

这里是ajax调用的片段,因为它很长

 }).promise().done(function () {
            $.ajax({
                type: 'POST',
                url: '/Patient/SaveWeight',
                dataType: 'json',
                contentType: 'application/json',
                data: JSON.stringify(add_upd_obj_arr),
                dataType: "json",
                traditional: true,
                success: function (result) {
                    if (result.errMsg == '' || result.errMsg == "") {
                        bootbox.alert({
                            size: "small",
                            title: "Confirmation!",
                            message: "Successfully Updated.",
                            callback: function () {
                                $('#ModalVitalSign').modal('hide');
                                location.reload();
                            }
                        });
                    } else {
                        bootbox.alert(result.errMsg);
                    }
                },
                error: function () {
                    bootbox.alert({
                        size: "small",
                        title: "Error!",
                        message: "There is an error while loading data."
                    });
                }
            });
        });

我尝试了这个,但没有刷新

 window.location.hash = tab_treatment_info; //id of the third tab

0 个答案:

没有答案