rendered paste body<!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>Jared's Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="tw-sack.js"></script>
<script type="text/javascript">
var ajax = new sack();
var blah = "";
function run_unique(f,v,db,table,col) {
function run_unique_loading() {
f.innerHTML = 'Loading... ';
//f.nextSibling.innerHTML = '<img src="/isol/assets/images/ajax-loader.gif" />';
}
function run_unique_checkcomplete() {
if(ajax.responseStatus) {
f.innerHTML = 'We got a response... ';
var db_string = ajax.response.toString();
var orig = v.toString();
alert('db_string: ' + db_string);
alert('orig: ' + orig);
if(db_string == orig) {
f.innerHTML = 'db_string equals orig';
return true;
} else if(db_string == 'no match') {
f.innerHTML = 'db_string was no match';
return true;
} else {
f.innerHTML = 'db_string was not orig or no match';
blah = 'The end!';
return false;
}
} else {
f.innerHTML = 'We did not get a response... ';
return false;
}
var db_string = '';
ajax.response = '';
}
alert('f value: ' + f.value);
ajax.setVar('db', db);
ajax.setVar('table', table);
ajax.setVar('col', col);
ajax.setVar('value', f.value);
ajax.setVar('action', 'check_unique');
ajax.requestFile = '/listener.html';
ajax.onLoading = run_unique_loading;
ajax.onLoaded = run_unique_loading;
ajax.onInteractive = run_unique_loading;
ajax.onCompletion = run_unique_checkcomplete;
ajax.runAJAX();
}
</script>
</head>
<body>
<h1>Blah</h1>
<form id="form" method="post">
<input type="submit" onClick="run_unique(document.getElementById('replaceme'),'b','c','d','e'); return false;" onDblClick="run_unique(document.getElementById('replaceme'),'b','c','d','e'); return false;" />
</form>
<div id="replaceme">Hello</div>
</body>
</html>