jQuery 'If' statement string comparison not working
You can fix it on the client side using $.trim()
like this:
if($.trim(data) == 'success') {
Or, a better approach would be removing the new-line coming from the server-side, probably an erroneous new-line in your PHP somewhere, check before or after the <? ?>
block, this is most often where they crop up.
Or, just exit after outputting your content, like this:
if($update) { echo 'success'; exit();}
You can remove the trailing ?> in your file, if it is the last line in the file. I want to response to the comments to the original issue, but i don't see how.
Client side validation working fine.
$.trim() fine.
Thank You Nick. It took me long to understand why its not working ...