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

JavaScript Express Basics Parameters, Query Strings, and Modularizing Routes Randomize Cards

Url 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

              form(action= `${id}?side=question` method='get')
                button(type='submit') Question

A question mark is a special character in JavaScript try escaping the question mark with a backslash /?

1 Answer

13,313 Points

I had the same issue and had to replace the buttons with normal links

if(side === "question")
        h2= prompt
        h2= text
        if hint
                i Hint: #{hint}
        a(href=id + "?side=answer") Answer
    if(side === "answer")
        h2 The answer is:
        h2= text
        a(href=id + "?side=question") Question