I do this $.post:
setTimeout("my_function();",1000);
function my_function()
{
var OrdID = "<?php echo $OrdID; ?>";
var UserID = "<?php echo $UserID; ?>";
$.post("addtocart.php",{
OrdID: OrdID,
UserID: UserID
}, function(data) {
$('#refresh').html(data);
console.log(data);
if (data != "Empty")
{
console.log(data);
}
});
And the addtocart.php echoes back “Empty” or a numeric value but the “if statement” is not working. Why?(new to $.post). Thanks
I tried:
if (data == "Empty")
{
console.log(data);
}
function myFunc() {
if (data == "Empty")
{
console.log(data);
}
}
var check = data;
if (check == "Empty")
{
console.log(check);
}
Was expecting the if statement to work but result is no entry in the console