[jQuery] remote ajax with jquery...

[jQuery] remote ajax with jquery...

I casually mentioned 'remote ajax' in another thread... I thought I'd
show a demo of it... very simple!
it's used to watch woot.com while they are doing rapid sales!
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <title>
            Wootster
        </title>
        <script type="text/javascript" src="/js/jquery.js"></script>
        <script type="text/javascript">
            $(function(){
                var doit = function(){
                    $.ajax({
                        url:'http.cgi?http://www.woot.com/DefaultMicrosummary.ashx',
                        success: function(data)    {
                            var title = '@' + new Date();
                            $('body').prepend('<div title="'+title+'">' + data + "</div>")
                            var sale = document.title = data.split('\r')[0];
                            if (!sale.match(/%/)) {
                                $('body').prepend('<h1>See you at 10pm! Woot is not flashing!</h1>')
                                clearInterval(interval)
                }}})}
                doit()
                var interval = setInterval(doit,40000)
                $('body').click(function(){window.location = "http://www.woot.com/"})
            })
        </script>
    </head>
    <body/>
</html>
is a simple page that ajaxes a microsummary repeatedly from another site.
and http.cgi is:
#!/usr/bin/perl
use LWP::UserAgent;
use CGI;
$ua = LWP::UserAgent->new;
$ua->agent("NuBrowser/10.7 ");
$res = $ua->request(HTTP::Request->new(GET => $ENV{QUERY_STRING} ||
"http://www.woot.com/DefaultMicrosummary.ashx"));
$q = CGI->new;
print $q->header($res->headers->{'Content-Type'}),$res->content;
--
Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/