I'm having a very hard time trying to do something very simple. Here's the code:
if(data == 'success') {
alert('foo');
} else {
alert(data);
}
I've simplified it, but that's all that's necessary to understand what's going on. the variable 'data' is a result of an AJAX call, if that makes any difference. The problem is that it always goes to the 'else' statement and it alerts 'success', which it shouldn't if it goes to the 'else'. Any idea what's going on here?
EDIT: Here's the full AJAX code in jQuery:
$.post("/manage_sites.php", {before:before, edit:after}, function(data){
if(data == success) {
alert('blah');
} else {
alert(data);
}
});
And then in the PHP response:
...code....
$update = mysql_query("UPDATE users SET feeds = '$afterFeed' WHERE username = '$name'") or die("Query Failed");
if($update) {
echo 'success'; //this is the 'string' that is being given to 'data'
}