Hi Guys,
I have a question..
I have the below html5 code that will show a html5 notification:
Code:
<script>
function RequestPermission (callback) {
window.webkitNotifications.requestPermission(callback);
}
function showNotification(){
if (window.webkitNotifications.checkPermission() > 0) {
RequestPermission(showNotification);
}
else {
window.webkitNotifications.createNotification("http://a1.twimg.com/profile_images/710503034/lillypad_rss_normal.png", "NEW chat request!",
"Someone would like to talk to you.").show();
}
}
</script>
How can I use ajax to call notify.php and if notify.php returns the value of "1" the page / ajax will then call the showNotification() function?
notify.php will contain only a 0 or 1. The above script is already in the head of the document thats calling the notify.php, So theres no need for the evaljs
Please anyone?
This is killing me and I suck @ JS / Ajax / Jquery..
An example code would be ace.
Essentially im looking for something like.
ajaxrequest="notify.php"
if ajaxrequest.answer = "1" {
showNotification();
}
Any thoughts?
Last edited by lynxus; 09-28-2010 at 02:00 PM..
|