Michael Pierce5821971
Posts: 0
Joined: Fri May 03, 2013 11:29 pm

Search for a username

In my game I am developing I have a popup that allows you to search for your friends username to start a game. I created a service to search for the username entered in the text input box and am using the "where" parameter for the query. I am also using Javascript on the "where" parameter to return the text inputted in the text box. The problem is no matter what name I put in the search box the service is returning a "Success" and creating a new game in the game collection of the database. I have and "Error" setup on the search service to alert that the username doesn't exist, but it always returns a success and creates a new game.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Search for a username

Did you test the service before using it on a page and it works correctly?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Search for a username

Also, please use browser dev. tools to see what request is being sent and what is being returned from the server.

Michael Pierce5821971
Posts: 0
Joined: Fri May 03, 2013 11:29 pm

Search for a username

Ok. Yes I tested it and it functioned perfectly and that's what I used to build the response from the server for my mapping. I'll try the dev tools but its weird.

Michael Pierce5821971
Posts: 0
Joined: Fri May 03, 2013 11:29 pm

Search for a username

This still isn't working and I really cannot figure it out. No matter what I put in the text box it is still invoking the create game service which is only supposed to be invoked if the search returns success. I checked the dev tools and it shows it is not returning a response at all but is still invoking the create game service which is only supposed to be invoked on the success of the query.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Search for a username

Do you invoke the second service on first service's success event? The service might not be returning any data but it is still a success (no error has occurred). Check the request (first service) to make sure it's correct.

Michael Pierce5821971
Posts: 0
Joined: Fri May 03, 2013 11:29 pm

Search for a username

Yes the second service is invoked on the first service' success event. I'm not sure what to check for in the first service. Would there be a way to run a JavaScript that checks for a response and then invoke the second service?

Michael Pierce5821971
Posts: 0
Joined: Fri May 03, 2013 11:29 pm

Search for a username

That is exactly what is happening. It returns a success but the response is blank. I'm not sure what to do now. I only want the second service to be invoked if the username that is searched for actually exists.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Search for a username

Check if the response is empty.. if yes, don't invoke the service.

Michael Pierce5821971
Posts: 0
Joined: Fri May 03, 2013 11:29 pm

Search for a username

What would the javascript be to check a response?

Return to “Issues”