Guest User

Untitled

a guest
Jan 12th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. $.ajax({
  2.  
  3. type: "POST",
  4. url: "mypage.php",
  5. data:{ //data user and pass
  6. },
  7. dataType: 'json',
  8. cache: false,
  9. success: function(data)
  10. {
  11.  
  12. function subscribe() {
  13. OneSignal.push(["registerForPushNotifications"]);
  14. event.preventDefault();
  15. }
  16.  
  17. var OneSignal = OneSignal || [];
  18.  
  19. OneSignal.push(function() {
  20. if (!OneSignal.isPushNotificationsSupported()) {
  21. return;
  22. }
  23. OneSignal.isPushNotificationsEnabled(function(isEnabled) {
  24. if (isEnabled) {
  25. // The user is subscribed to notifications
  26. // Don't show anything
  27. } else {
  28. subscribe();
  29. }
  30. });
  31. });
  32. }
  33. });
Add Comment
Please, Sign In to add comment