Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var updates = new XMLHttpRequest();
- updates.onreadystatechange = function(){
- "use strict";
- if(updates.readyState === 4 && updates.status === 200){
- console.log(updates.responseXML);
- }
- };
- var timer = 0;
- clearInterval(timer);
- timer = setInterval(function(){
- "use strict";
- updates.open('GET','scripts/check_for_notifications.php', true);
- updates.send();
- },2000);
- $response = new SimpleXMLElement('<xml/>');
- $update = $response->addChild('update');
- $update->addChild('content', 'New message');
- $update->addChild('redirect', 'some link');
- $update->addChild('date', '1.1.2019 12:00');
- header('Content-type: text/xml');
- print($response->asXML());
- updates.open('GET','scripts/check_for_notifications.php&nocache=' + new Date().getTime(), true);
Add Comment
Please, Sign In to add comment