I have a success function in my AJAX which returns the response text from a python script which can be either \"SUCCESS\" or \"EMPTY\". Now I want to place an if-loop insid
submitHandler: function (form) {
$.ajax({
type: 'post',
url: '/cgi-bin/getdataworld.py',
data: $(form).serialize(),
success: function(data1) {
//document.write(result);
console.log("result is "+data1);
alert(data1);
if(data1 == "SUCCESS"){
window.location = 'index.html';
}
else{
alert("NO DATA PRESENT");
}
},
error: function (responseData) {
console.log('Ajax rariequest not recieved!');
}
});
return false;
}
try this here two things i noticed one is === in if statement and other you are using data as variable some time its conflicts in some browser