Reputation: 1472
I am using setTimeout
for getting new data at interval of 30 seconds, but it's not working, don't know where it's messed up. Here is my code:
(function pollmsg() {
setTimeout(function () {
var demon = $('.msgnotimore').val();
var a = $('.gvpgvpxgvp').val();
$.ajax({
url: 'modules/notifications/beast.php?nid=' + demon + '&id=' + a,
success: function (data) {
$('.notiloadmsg').append($(data).fadeIn('slow'));
alert(data);
},
dataType: "json",
complete: pollmsg
});
}, 30000);
})();
When I try to alert demon
, it alerts demon
after 30 sec, but the data is not alerted.
Upvotes: 0
Views: 114
Reputation: 4423
dataType: "json"
should not be used when fetching HTML
instead use "html"
Upvotes: 3