Files
harbour-core/harbour/examples/uhttpd/home/testajax.html
Viktor Szakats 461ea1568f 2009-05-29 11:04 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
- contrib/examples
  + examples
  * doc/dirstruc.txt
  * doc/whatsnew.txt
  * examples/hbdoc/Makefile
  * examples/pp/Makefile
  * examples/hboleold/Makefile
  * examples/hbsqlit2/Makefile
  * examples/misc/Makefile
  * examples/hbapollo/Makefile
  * examples/rdddbt/Makefile
  * examples/guestbk/Makefile
  * examples/pe/Makefile
  * examples/hbgf/hbgfwin/Makefile
  * examples/hbgf/hbgfos2/Makefile
  * examples/hbgf/hbgfgtk/Makefile
  * examples/hbgf/Makefile
  * examples/uhttpd/readme.txt
  * examples/dbu/Makefile
  * examples/hscript/Makefile
  * examples/hbwhat/Makefile
  * examples/rl/Makefile
  * examples/Makefile
    * Moved to flatten our dir layout and sync the locations
      in unified distro and source tree.
    ; TODO: As a next step I'll replace Makefiles with .hbm 
            files. This will allow users to build these parts 
            outside the source distribution.
2009-05-29 09:05:10 +00:00

56 lines
1.4 KiB
HTML

<html>
<head>
<title>Simple Ajax Example</title>
<script language="Javascript">
function xmlhttpPost(strURL)
{
var xmlHttpReq = false;
var self = this;
// Mozilla/Safari
if ( window.XMLHttpRequest )
{
self.xmlHttpReq = new XMLHttpRequest();
}
// IE
else if ( window.ActiveXObject )
{
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function()
{
if ( self.xmlHttpReq.readyState == 4 )
{
updatepage( self.xmlHttpReq.responseText );
}
}
self.xmlHttpReq.send( getquerystring() );
}
function getquerystring()
{
var form = document.forms[ 'f1' ];
var word = form.word.value;
qstr = 'w=' + escape(word); // NOTE: no '?' before querystring
return qstr;
}
function updatepage( str )
{
document.getElementById( "result" ).innerHTML = str;
}
</script>
</head>
<body>
This is a simple ajax test. Please type a string in input field and press GO button.
<form name="f1">
<p>word: <input name="word" type="text">
<input value="Go" type="button" onclick='JavaScript:xmlhttpPost("/cgi-bin/testajax.hrb")'></p>
<div id="result"></div>
</form>
Return to <a href="/">Main Page</a>
</body>
</html>