Index.cfm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<head>
	<title>Greeting AJAX application</title>

	<script type='text/javascript'>_cfscriptLocation = "model.cfm";</script>
	<script type='text/javascript' src='core/engine.js'></script>

	<script type="text/javascript">
	function getGreetings()	{
		DWREngine._execute(_cfscriptLocation, null, 'getGreetings',  getGreetings_result);
	}
	
	function getGreetings_result (msg) {
		alert(msg);
	}
	</script>
</head>

<body onload="getGreetings();"></body>
</HTML>


Index.cfm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<head>
	<title>User Check</title>

	<script type='text/javascript'>_cfscriptLocation = "model.cfm";</script>
	<script type='text/javascript' src='core/engine.js'></script>
	<script type='text/javascript' src='core/util.js'></script>

	<script type="text/javascript">
	function checkUser()	{
		DWRUtil.useLoadingMessage();
		var user = document.frm.user.value;
		DWREngine._execute(_cfscriptLocation, null, 'userExists', user, checkUser_result);
	return false;
	}
		
		
	function checkUser_result (userExistsBool) {
		if (userExistsBool == 'true') {
			alert('Sorry, that user already exists');
			return false;
		}
		document.frm.submit();
	}
	</script>
</head>

<body>

<form name="frm" method="post" onsubmit="return checkUser();">
	<input type="Text" name="user">
	<input type="Submit" value="register">
</form>

</body>
</HTML>