I have an application in asp.net mvc 5 where the code below works locally (visual studio 2012), but does not work after posting to the server.
controllerAction = "/Controller/Action/"
controller = "/Controller/"
$('#approve-btn').click(function () {
$.ajax({
type: "POST",
url: controllerAction,
data: { id: idElementoClicado },
datatype: "html",
success: function (data) {
$("#ajaxgrid").load(controller + ' #ajaxgrid', function () {
});
},
error: function () {
alert(response);
}
});
$('#modal-container').modal('hide');
});
[HttpPost]
public ActionResult Excluir(CentroCustoViewModel viewModel)
{
//bloco de execução
return Json(datasource, JsonRequestBehavior.AllowGet);
}
Clicking on the button that triggers the action always falls on the error event and issues the alert.
Does anyone know what might be happening?
Thank you