this is my code, a normal code as the examples on jquery.com ajax.php can only echo "OK1", "OK2" or "KO", so I wonder why none of the if in the success function work ? but the alert before works well and i set dataType = text just to be sure. It's like mess is another type of variable or what ? Thank you
$.ajax({ type:"POST", url:"ajax.php", data:"act=buy, cache:false, dataType: "text", beforeSend: function(){ // Loading }, success: function(mess){ var txt = mess; alert(txt); if(txt=="OK1") alert(txt); if(txt=="OK2") alert(txt); if(txt=="KO") alert(txt); }, error: function(){ // Errore } });