Welcome to the Browser-Base Game Zone forums!
I can send you pics of my cocks if you want reference.
function checkuname(uname,pw){ xmlhttp = getxmlhttp(); xmlhttp.open("POST","checkreg.pl?uname="+uname+"&passwd="+pw); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 ) { try { if ((xmlhttp.status == 200)){ //alert("XML=" + xmlhttp.responseText ); str = eval("(" + xmlhttp.responseText + ")"); if (str.result == "1"){ document.location = 'http://new.page.com'; } else { document.getElementById('popdiv').innerHTML = str.message; } return; } else { alert("ERROR BAD STATUS=" + xmlhttp.status); document.getElementById('popdiv').innerHTML = "Bad status code:" + xmlhttp.status; return; } } catch(err) { alert("JS Error" + err); document.getElementById('popdiv').innerHTML = "JS error:" + err; return; } } } document.getElementById('popdiv').style.visibility = "visible"; xmlhttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" ); xmlhttp.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" ); xmlhttp.send(null); return;}
sub checkreg { my $uname = shift; my $pass = shift; my $result = -1; my $msg = "None"; if ($uname eq $pass){ $result = 3; $msg = "Don't use your uname as you password !"; }#$exists = RESULT OF EXISTS QUERY;if ($exists) { $result = 2; $msg = "Sorry that username is taken"; } else { $result = 1; $msg = "This will not be seen..."; #insert the new user; } return "{\"result\": \"$result\"\n, \"message\": \"$message\"}";}
{"result":"abc","message":"def"}
What I'd really like to do is use AJAX for form checking... so the user has instant feedback if something is wrong. No need to submit a form and find out you've been entering the wrong things!But... I don't know how to implement that and I don't think I'd have the time to spare for learning it
I did find a fine example what you can do with AJAX: Civilization Clone