I have a PHP script that I'm calling with the .post()
function in jQuery. If everything goes well, it outputs "WIN", otherwise it outputs whatever database errors or whatever else it gets.
$.post("myscript.php", {key: "value"}, function(data) {
if(data=="WIN") {
// the stuff that I want it to do that it won't do
} else {
alert(data);
}
});
When it runs however, I get "WIN" in a JS alert, and the stuff that I want it to do doesn't happen. Since "WIN" shows up in the alert, the PHP script is clearly outputting what I had expected. I had even made sure to set the Content-Type
of the PHP script to text/plain
, so why doesn't data=="WIN"
. Why does my WIN FAIL?