Client side, this is what I have happening:
function saveGrades() {
$.post("/savegrades", {classIndex: "classIndexId"}); }
Server side:
router.post('/savegrades', stormpath.loginRequired, function(req, res) {
console.log("Class index: " + req.body.classIndex);
console.log(req.body);
res.send(200);
});
My bodyParser
settings are as follows:
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
No matter what I have tried, req.body
is empty and does not have the classIndex
. What am I doing incorrectly? Why is the data not being posted to the server?
Edit: For the linked questions, I have gone through almost all relevant answers here and am unable to find a solution. It seems that that data is never being sent to the server whatsoever. The body is always empty when I check it with a debugger.