I created a modal block to display my View Create. When clicking on btnNew, a javascript event should call my Action Create return a blank view and load inside the modal ... Only modal only is opening. I followed with BP and found that the click event is not calling Action Create with the route I'm going through. Can anyone tell me where I'm going wrong?
[HttpGet]
[Authorize(Policy = "CanWritePessoaSituacaoData")]
[Route("situacoes-gerenciamento/cadastrar-novo")]
public IActionResult Create()
{
return View();
}
Below is the code for btnNew, the modal block and ref. to the script:
<a id="btnNovo" class="btn btn-outline btn-default new" data-toggle="modal" href="#myModal"
data-original-title="Cadastrar Novo" >
<span title="Cadastrar Novo" class="icon wb-plus"></span> Cadastrar Novo
</a>
<div id="myModal" class="modal fade" role="dialog" data-backdrop="static" tabindex='-1' aria-labelledby="myModalLabel" aria-hidden="true" style="display:none" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h4 class="modal-title" id="myModalLabel">Gerenciar Situações de Pessoas</h4>
</div>
<div class="modal-body">
<div id="modal-content">
Carregando...
</div>
</div>
</div>
</div>
</div>
@section scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
<script src="~/js/PessoaSituacao/PessoaSituacao.js"></script>
<script type="text/javascript">
}
Follow the js script:
$("btnNovo").click(function (eve) {
$("#modal-content").load("situacoes-gerenciamento/cadastrar-novo");
});