I have a JavaScript function that triggers on a button click, but the Chrome Developer Tools skips over the AJAX Post. A 500 Error occurs, but break points inside the Controller are never hit, so none of the variables appears to be passing. I've seen many JavaScript questions on this site, but couldn't find one that addressed this situation. Here's what my code looks like and thanks in advance!
JavaScript:
$("#calculate").click(function () {
var $indicator = $("#Indicator");
$.ajax({
type: "POST", //THIS IS NEVER HIT, JUST SKIPPED OVER!
url: '@Url.Action("LogPrices", "Sales")',
data: {
indicator: $indicator.val(), iD: $("#ID").val()
},
success: function (data) {
// logic
}
});
});
Controller:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult LogPrices(bool indicator, long iD)
{
// logic
return Json(priceLog, JsonRequestBehavior.AllowGet);
}