String equality( == ) issue in javascript

67 Views Asked by At

I am getting undesired output when i compare the ajax response to a string.
My backend is PHP. It is an echo 'SUCCESS' that responds to the ajax call.
When i compare the response with "SUCCESS" it is giving a false output!

Let me attach a screenshot of the console watch window for clarity.

Console screenshot

Please help me with a workaround. Thank you!

1

There are 1 best solutions below

1
On BEST ANSWER

I guess there is a space in the success written at the top (pinkish) one. Remove that. For checking give a space in the if condition. If it succeeds then that is the issue.