1

I am trying to pass in some data as parameters in jquery method but it seems to be not working.

  $.get('/quizes', { name: "John", time: "2pm" }, function (data) {
    console.log(data)
    renderQuiz(data)
  });

However, on my express route, when I am looking for the data in req.body, it is showing undefined. What am I missing?

1
  • There is no body for a Get. The params are serialized into url query string path/to/server?name=John&time=2pm. If you want to keep same body code switch to POST Commented Jun 3, 2021 at 1:12

1 Answer 1

3

Those parameters are not in req.body they are in req.query.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.