Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Raghav Narang
7,336 PointsData event never fires
I had performed all the steps in the video. Only got stuck when it reads the Posted data by form. Whenever I submit the search form, the page keeps loading indefinitely. Because data event never fired.
I have found this article from internet, on How do properly read post data? and also shown the possibility that data event triggered before function is binded to data event. That's why data event never triggered function.
Please recommend a correct way to bind subscribe to data event of request parameter.
2 Answers
Steven Parker
243,318 PointsWithout seeing your code or a link to the video I'm mostly guessing, but the obvious solution seems to be making sure the event handler is bound before transmitting the form that could cause the event. Is there something about the scenario that would prevent this?
If this doesn't happen to resolve the issue, perhaps you could provide a link to the course and video, plus make a snapshot of your workspace and post the link to it here.
Raghav Narang
7,336 PointsRaghav Narang
7,336 PointsLink to Video:
Dealing with the POST Body
Here is the code.
app.js:
router.js: