I'm using jquery-ajax to send data to a php. Upon success or failure the php sends back a response. so far everything works fine. Now my questions is how do I use an if statement in jquery to do some action using the response?
See example:
$.post("php/send.php",
{
email:$( '#email' ).val(),
name:$( '#name' ).val()
},
function(response) {
alert(response) // shows "Error!"
if (response != "" || response != "Error!") {
//do A...
} else {
//do B...
}
)};
My if statement does not work. Even the response from the php is "Error!" it will //do A.How do I fix this?