hello its really weird that a if and else statement is not working in my function even after the value comes in “no” then also the else part is executed instead of if my code is
(function pollmsg() {
setTimeout(function () {
var demon = $('.msgnotimore').val();
alert(demon);
var a = $('.gvpgvpxgvp').val();
$.ajax({
url: 'modules/notifications/beast.php?nid=' + demon + '&id=' + a,
success: function (html) {
if(html == "no") {
alert('no');
} else {
alert('ok');
$('.msgnotimore').val();
$('.notiloadmsg').prepend($(html).fadeIn('slow'));
}
},
dataType: "html",
complete: pollmsg
});
}, 30000);
})();
});
i alerted html to check the value returning . its “no” but still the else part is working how is this possible ?
Try trimming html before doing the check.