Skip to content
Advertisement

Comparing php value with javascript variable?

I am working on php and javascript project. I just want to compare echo return value of php with javascript variable.

php backend code which returns ‘no’ using echo

JavaScript

Now comparing with javascript variable

JavaScript

it give same result if value are same or not. i also JSON.stringify but it still not working

Advertisement

Answer

The output from the URL probably includes white space.

JSON is a good way to normalize that, but you need to apply it at the PHP end, not the JavaScript end.

JavaScript

and then:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement