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 trialStephen Powers
12,091 PointsUrl issues
I understand his solution, but I'm wanted some insight as to why my solution isn't working.
I handled the majority of the logic in Pug, and the only thing not working is when I include the "?" in the code (inlcuded below), everything after it disappears when the request is made. When I omit it, the url renders completely, but without the "?". So I end up with an error because it's not included in the url. What am I missing?
if side === 'question'
form(action= `${id}?side=answer` method='get')
button(type='submit') Answer
else
form(action= `${id}?side=question` method='get')
button(type='submit') Question
1 Answer
andreavitiani
13,313 PointsI had the same issue and had to replace the buttons with normal links
if(side === "question")
h2= prompt
h2= text
if hint
h6
i Hint: #{hint}
a(href=id + "?side=answer") Answer
if(side === "answer")
h2 The answer is:
h2= text
a(href=id + "?side=question") Question
Aidan Lowson
10,379 PointsAidan Lowson
10,379 PointsA question mark is a special character in JavaScript try escaping the question mark with a backslash
/?