I need to present a list of results by completing the form below, but the search is not displaying the result. The action in controller is not being thrown.
@using (Html.BeginForm())
{
<div class="form-group">
@Html.LabelFor(model => model.ProfissionalID, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DropDownList("ProfissionalID", Model.Profissionais, "", new Dictionary<string, object> { { "class", "chosen-select" }, { "data-placeholder", "Selecione" } })
@Html.ValidationMessageFor(model => model.ProfissionalID, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Pesquisar" class="btn btn-default" onclick="return efetuarPesquisa()" />
</div>
</div>
}
<div id="resultado">
</div>
function efetuarPesquisa() {
if (!$('#ProfissionalID').val()) {
$.MessageBox("Selecione o profissional");
$('#ProfissionalID').focus();
return false;
}
$("#resultado").load('/Lancamento/BuscarLancamentosProfissional/' + $("#ProfissionalID").val());
return true;
}
Action that will populate the list:
[HttpPost]
public PartialViewResult BuscarLancamentosProfissional(int profissionalId)
{
var model = _edicaoMapper.Mapear(_lancamentoService.BuscarLancamentosProfissional(profissionalId));
return PartialView("Edit", model);
}