基本上我有我的页面上使用JavaScript的少数选项卡的MVC网站。返回视图与参数
然后,我有JavaScript方法读取这个URL,并使用AJAX来选择,像这样适当的标签:
function onbodyLoad(URL) {
if (URL.indexOf("Login/Register") != -1) {
var index = 4;
var $tabs = $('#tabs').tabs();
$tabs.tabs('url', index, "/Login/RegistrationConfirmation");
$tabs.tabs('select', index + 1);
$tabs.tabs('select', index);
}
}
现在我检查在控制器httppost方法无效一些属性,并返回一个视图。它的作品,但风格缺失,所以必须按照上述方式。
如果没有错误,并且它们写入URL为“错误”,是否可以写入页面URL“成功”?所以在上面的函数中,我可以检查URL并转发到适当的选项卡。
或者也许用参数写一个actionresult方法并返回它。但不知道...任何人都可以摆脱一些光请
希望它是有道理的。
更新: 在我的控制器,我这样做是为了参数添加到我的注册视图:
RouteValueDictionary rvd = new RouteValueDictionary();
rvd.Add("ParamID", "1");
return RedirectToAction("Register", "Login", rvd);
和jQuery我这样做是为了读取URL,并选择该选项卡:
if (URL.indexOf("Login/Register?ParamID=1") != -1) {
var index = 2;
var $tabs = $('#tabs').tabs();
$tabs.tabs('url', index, "/Login/Register");
$tabs.tabs('select', index + 1);
$tabs.tabs('select', index);
}
我可以看到带参数的网址,但jquery似乎不起作用,它只是说无法找到。请帮忙吗?
'.tabs()'做了什么? – David
它声明一个标签 – Zaki
一个“标签”?那是什么,一个插件? – David