文字列値をアイテムの作成ダイアログに渡そうとしていますが、その方法がわかりません。
これは私の見解のコードです:
JavaScript:
function newRoute() {
$.ajax({
url: '@Url.Action("Create")',
success: function (data) {
if (data == "success") //successfully created the new route
window.location.href = '@Url.RouteUrl(ViewContext.RouteData.Values)'
else
$.facybox(data); // there are validation errors, show the dialog w/ the errors
}
});
}
意見:
<td>@route</td>
<td>
<a href="javascript:newRoute();" class="button">Add</a>
</td>
コントローラー:
public ActionResult Create(string routeName = "")
{
PopulateRouteInfoViewBag();
var newRoute = new RouteInformation();
newRoute.Name = routeName;
return View(newRoute);
}
@routeの値を取得し、それをCreateコントローラーに渡して、渡された文字列値を使用してダイアログをポップアップ表示しようとしています。