How fast is this!

Björnke von Gierke bvg at mac.com
Tue Feb 19 13:00:19 CST 2008


I did some testing late last year, and the basic's are very simple:

The scary part is the javascript, which is only as huge because it  
needs to care for two versions of internet explorer in addition to all  
the rest:


<html>
<body>

<script type="text/javascript">
function ajaxFunction()
   {
   var xmlHttp;
   try
     {
     // Firefox, Opera 8.0+, Safari
     xmlHttp=new XMLHttpRequest();
     }
   catch (e)
     {
     // Internet Explorer
     try
       {
       xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
       }
     catch (e)
       {
       try
         {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
       catch (e)
         {
         alert("Your browser does not support AJAX!");
         return false;
         }
       }
     }
     xmlHttp.onreadystatechange=function()
       {
       if(xmlHttp.readyState==4)
         {
         document.myForm.time.value=xmlHttp.responseText;
         }
       }
     xmlHttp.open("GET","/cgi-bin/time.cgi",true);
     xmlHttp.send(null);
   }
</script>

<form name="myForm">
Name: <input type="text"
onkeyup="ajaxFunction();" name="username" />
Time: <input type="text" name="time" />
</form>

</body>
</html>


This will enter the data gotten from "time.cgi" into the second input  
field, whenever you type in to the first field. The cgi now only needs  
to be this:

#!rev

on startup
   put the short system date into temp
   put "Content-Type: text/plain" & cr
   put "Content-Length:" && the length of temp & cr & cr
   put temp
end startup

That's it!

I learned most of my web stuff from w3schools.com, it's a very good,  
and newbie friendly ressource.

have fun
Björnke

PS: AJAX means Asynchronous JavaScript and XML, but i used totally  
extreme plain text, so this is more like AJAP ;-)

PPS: if time.cgi where time.php (or, rev isn't always less lines):

<?php
echo Date("G:i:s");
?>

On 19 Feb 2008, at 16:59, Thomas McGrath III wrote:

> Can you explain this a little further. I am not proficient in CGI or  
> AJAX but am now 'forced' into learning JS, CSS, XML in order to put  
> a web based application together. I did not want to learn another  
> language either and have put this off as long as I can. But now I  
> must. So a newbie I am and feel lost in a bigger world than me.
>
> Is there a real newbie way to learn how to integrate AJAX with REV?  
> I have been reading daily and have put my other projects on hold.
>
>
> Thanks
>
> Tom
>
> On Feb 19, 2008, at 8:37 AM, Sivakatirswami wrote:
>
>> . but... AJAX with Rev on the back end is very powerful......Next  
>> on my agenda: take raw content (photos and text-caption files) and  
>> build Highslide JS web objects for inclusion in web pages via SSI's  
>> --  love doing <!include exec="someCoolRev.cgi" -->  and then let  
>> revolution do the work of building into that space on the page--  
>> that is after all, what PHP is doing, but at 1/10th the speed of  
>> Revolution on the same box/CPU...
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list