[Solved] jQuery true and false [closed]


Give that the following assumption is correct (this this is often the cause of this sort of problem):

/Game/CheckName returns a piece of text that is either the word “true” or the word “false”

Then the solution is:

Compare strings, not booleans.

if (data === "true") {}

Beware whitespace in your output. It will stop the code matching an exact string. You can avoid that possibility by checking for the substring “true” appearing anywhere in the result:

if (data.indexOf('true') >= 0) {}

3

solved jQuery true and false [closed]