1

I consistently get this error when running check50 on pset8 Finance problem from CS50 when I assume it tries to add a new user that isn't in the user database.
ERROR MESSAGE

However when I enter a new user myself, the networks tab on google's Development tools shows that status 200 is returned.

check?user=card STATUS 200

I am at a loss here.

Here is my @pp.route("/check)

@app.route("/check")

Here is my register script

register script

And here is my register html.

enter image description here

Can anyone help me zero in on why I am still receiving an error from check50. It seems my code works fine. If the username is taken an alert is set and the form is reset, and auto focus is returned to user. If the name is not taken then the user is added to my sqlite database and a status 200 is returned. I can't see why check50 is returning an error.

1

Needs to be ?username=, not ?user=, in Python and JS. This test is performed without your form, just by doing that specific request.

From the problem statement on /check:

  • The route should accept, via GET, an HTTP parameter called username.
6
  • I don't think so. in this case within the script the val user gets it's data from $("#username").val(); then that value of user is passed into $.get('/check?user='+user. Moving into the python file. username is assigned the value of user from request.args.get('user') then names searches the database using username. But i still receive an error. If I change the code from ?user= to ?username= it breaks and always alerts that name is taken whether or not it is. – booklvr Mar 21 '19 at 7:04
  • Your Python and JavaScript are consistent, that's why they work for you. Checker uses its own URL assuming parameter is "username". – Blauelf Mar 21 '19 at 7:21
  • Thanks after changing from user to username for all variables and tweaking the logic of my @app.route("check") it finally passes all checks. This is one of those situations where I have tried so many things I am not exactly sure what change I made that was actually successful. Thanks for your help. – booklvr Mar 21 '19 at 12:45
  • it is my first time asking a question. how do i mark it as solved? – booklvr Mar 21 '19 at 12:47
  • In your code above, two places are relevant. $.get('/check?user=' would have to be $.get('/check?username=', request.form.get("user") should be request.form.get("username"). Those are the sending and the receiving ends of the HTTP GET parameter. – Blauelf Mar 21 '19 at 12:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .