3
I’m doing a crud and would like to open another page in modal form, but do not know how to do this, I even found on a site explaining how to do with javascript but when clicking the button nothing happens. Could anyone help me? On the Index page I wanted to open the Create page in modal form.
Página Index:
@{
ViewBag.Title = "Index";
}
<div class="p-3 mb-2 bg-light text-dark">
<div class="row">
<div class="col-8"><h3>Index</h3></div>
<div class="col-4">
<button type="button"
onclick="criar()"/>
@Html.ActionLink("+", "Create")
</div>
</div>
</div>
@{
<script>
function criar() {
$("#modalCreate").load("/Pracas/Create", function () {
$("#modalCreate").show();
});
}
</script>
}
Página Create:
@{
ViewBag.Title = "Create";
}
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Create</h4>
texto
</div>
}
Thank you.
Also put your Javascript code to make it clearer what you’re trying to do
– Maycon F. Castro
Maycon, I added the javascript that was missing!
– Luis