【发布时间】:2021-03-20 06:42:26
【问题描述】:
我想在 aspcore 中传递一个 Javascript 创建的字符串作为路由数据。该字符串是从 Javascript 数组中创建的,如下所示:
<body>
FULL LIST: <span id="Inventory"></span>
</body>
<script>
var FullString = LargeList.concat(SmallList);
LenB = BoxList.length;
FullString.push(LenB);
document.getElementById("Inventory").innerHTML = FullString.join("/");
</script>
我想我可以再次使用 Javascript 来创建链接,但这似乎不是正确的想法。
<body>
<input type="button" onclick="AddToFiv()" value="Create A 5/I Remark" />
<p id="FivRemarkLink"></p>
</body>
<script>
function AddToFiv() {
var FullString = LargeList.concat(SmallList);
LenB = BoxList.length;
FullString.push(LenB);
var Inventory = FullString.join("/");
var text = "<a asp-action="FivCreate" asp-route-zero="@ViewBag.zero" asp-route-code="I" asp-route-priority="5" asp-route-remark=" + Inventory + ">ADD 5/I</a>";
document.getElementById("FivRemarkLink").value = text;
}
</script>
【问题讨论】:
标签: javascript c# asp.net-core model-view-controller