daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var updates = new XMLHttpRequest();
  2. updates.onreadystatechange = function(){
  3.     "use strict";
  4.     if(updates.readyState === 4 && updates.status === 200){
  5.         console.log(updates.responseXML);
  6.     }
  7. };
  8.  
  9. var timer = 0;
  10. clearInterval(timer);
  11. timer = setInterval(function(){
  12.     "use strict";
  13.     updates.open('GET','scripts/check_for_notifications.php', true);
  14.     updates.send();
  15. },2000);
  16.    
  17. $response = new SimpleXMLElement('<xml/>');
  18.  
  19. $update = $response->addChild('update');
  20. $update->addChild('content', 'New message');
  21. $update->addChild('redirect', 'some link');
  22. $update->addChild('date', '1.1.2019 12:00');
  23.  
  24. header('Content-type: text/xml');
  25. print($response->asXML());
  26.    
  27. updates.open('GET','scripts/check_for_notifications.php&nocache=' + new Date().getTime(), true);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top