Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Background script
- From: lists at dwsasia.com (Peter Lauri)
- Subject: [Javascript] Background script
- Date: Mon Aug 28 23:22:35 2006
Yes, it was that simple. But I needed to create a unique http variable for
this, my original http was used in the rest of the script, and they could
not share connection.
var http2 = getXMLHTTP();
function checkAlerts() {
geturl = "messageajax.php?action=alertunreadmsg";
http2.open('get', geturl);
http2.onreadystatechange = ajaxCheckAlertsHandle;
http2.send(null);
}
function ajaxCheckAlertsHandle() {
if(http2.readyState == 4) {
document.getElementById("alertbox").innerHTML =
http2.responseText;
setTimeout(checkAlerts, 30000);
} else {
document.getElementById("alertbox").innerHTML = "<p>Checking
inbox...</p>";
}
}
/Peter
-----Original Message-----
From: javascript-bounces@xxxxxxxxxx [mailto:javascript-bounces@xxxxxxxxxx]
On Behalf Of Fl?vio Gomes
Sent: Tuesday, August 29, 2006 1:43 AM
To: [JavaScript List]
Subject: Re: [Javascript] Background script
/> Is it as simple as just setting a timer function that triggers my
function?
> Or is it any drawbacks with doing that? Is other scripts available
during this time?
/Never played with AJAX, but I believe that "Yes, it's just that simple".
Try it and tell us.
Peter Lauri escreveu:
> Best group members,
>
>
>
> I have a site where I have an internal message system. With this I
> want to add functionality so that when a user have a new message, an
> alert box will show up with that information.
>
>
>
> What the script actually would do is to every minute connect execute a
> script that use AJAX to retrieve the number of unread messages, and
> then alert if it is more then the last time.
>
>
>
> I want to have a script that does not effect other scripts on the site.
>
>
>
> Is it as simple as just setting a timer function that triggers my
> function? Or is it any drawbacks with doing that? Is other scripts
> available during this time?
>
>
>
> Best regards,
>
> Peter Lauri
>
>
>
>
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Javascript mailing list
>Javascript@xxxxxxxxxx
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
--
Flavio Gomes
flavio@xxxxxxxxxxxxxxxx
_______________________________________________
Javascript mailing list
Javascript@xxxxxxxxxx
https://lists.LaTech.edu/mailman/listinfo/javascript
- References:
- [Javascript] Background script
- From: Flávio Gomes
- [Javascript] Background script
- Prev by Date: [Javascript] Background script
- Next by Date: [Javascript] check checkboxes in <fieldset>
- Previous by thread: [Javascript] Background script
- Next by thread: [Javascript] check checkboxes in <fieldset>
- Index(es):