Can an if conditional be used to validate the result of a variable ?, something like:
$("#update").submit(function(e){
e.preventDefault();
$.ajax({
url: "ruta/al/archivo/uploadFac.php",
type: "POST",
data: new FormData(this),
contentType: false,
cache: false,
processData: false,
success: function(data){
if(var != 0){
$('#upload').modal('hide');
$('#Fac').modal('hide');
}else{
alert("ERROR");
}
},
error: function(data){
console.log(data)
}
});
});
});
Where the variable "var" is a variable that I get from the uploadFac.php script with which the request was made, can that be done?