I\'m having a very hard time trying to do something very simple. Here\'s the code:
if(data == \'success\') {
alert(\'foo\');
}
Client side validation working fine.
$.trim() fine.
Thank You Nick. It took me long to understand why its not working ...
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.
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();
}