<!DOCTYPE html PUBLIC "- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>ColdFusion 8 JSON / AJAX Demo</title>
<script
type="text/javascript"
src="jquery-latest.pack.js"
></script>
<script type="text/javascript">
function GetWords(){
$.getJSON(
"TextUtility.cfc?wsdl",
{
method : "GetWords",
text : $( "#phrase" ).val()
},
ShowWords
);
}
function ShowWords( arrWords ){
var jTextArea = $( "#words" );
jTextArea.val( "" );
$.each(
arrWords,
function( intI, strWord ){
jTextArea.val(
jTextArea.val() +
strWord +
"\r"
);
}
);
}
$(
function(){
$( "#submit" ).click( GetWords );
}
);
</script>
</head>
<body>
<form>
<p>
<input
type="text"
id="phrase"
name="phrase"
size="40"
/>
<input
type="button"
id="submit"
value="Get Words"
/>
</p>
<p>
<textarea
name="words"
id="words"
cols="50"
rows="20">
</textarea>
</p>
</form>
</body>
</html>