AJAX Help Please, code not working?

Why wont this code work?
If code doesn't display correctly see: http://beta.site.global-warming/ajaxtest/example.txt

//FILE ONE: fileX.php
<?
function dualHash($string, $salt) {
sha1($string);
}
if (isset($_GET['dualHash'])) {
echo dualHash($_GET['dualHash'], $_GET['salt']);
}
?>
//FILE ONE: fileX.php

//FILE TWO: fileY.php
<script type="text/javascript">
function dualHash(string, salt) {
var hash = null;
var xmlhttp;
if (salt) {
string = string+'&salt'+salt;
}
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject) {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else {
alert("Your browser does not support XMLHTTP!");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
hash = xmlhttp.responseText;
}
}
xmlhttp.open("GET","fileX.php?dualHash="+string,true);
xmlhttp.send(null);
return hash;
}
document.write(dualHash('password'));
</script>
//FILE TWO: fileY.php
SORRY LINK IS: http://beta.site.freehostia.com/ajaxtest/example.txt
 
Back
Top