0
我有剃刀形式像這樣在剃刀網址PARAM添加到一個div
@using (Html.BeginForm("ResetPassword", "Login", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div id="email_label" style="font-size:14px;padding:8px;">Email:</div>
<div class="form-group">
@Html.EditorFor(x => x.user, new { htmlAttributes = new { @class = "form-control", placeholder = "enter email from url" } })<br />
@Html.ValidationMessageFor(x => x.user)
</div>
}
我想從URL值來代替placeholder = "enter email from url"
。
網址:example.com/[email protected]&pass=123
現在我正在做這在Javascript,但我想這樣做的剃刀。但我似乎無法得到任何地方。
下面是我在做什麼在Javascript:
let url = new URL(window.location.href);
let searchParams = new URLSearchParams(url.search);
let emailAddress = (searchParams.get('email'));