Very Basic Javascript Call to CFC help
I'm trying to venture into AJAX a little, and am facing some obstacles. First, for full disclosure, we're running Coldfusion 7 (I know, I know...).
I set up my cfc page (16_echAjax.cfc) with the following basic code:
<cfcomponent
output="false">
<cffunction
name="helloWorld"
access="remote"
returntype="string"
output="false" >
<cfargument
name="name"
type="string"
required="no" />
<cfif isDefined("arguments.name") AND arguments.name NEQ "">
<cfreturn "Hello, #arguments.name#" />
<cfelse>
<cfreturn "Hello, Nameless" />
</cfif>
</cffunction>
</cfcomponent>
When I open a browser and type in "16_echAjax.cfc?method=helloWorld&name=Bob", the page opens and I see "Hello, Bob", so I know the coldfusion is working.
On my return page (16_echAjaxReply.cfm), I have a button that calls the "myCall" function and shows the response in a text box called "results". My javascript code looks like this:
<script>
function myCall() {
var request = $.ajax({url: "16_echAjax.cfc?method=helloWorld&name=Bob"});
document.getElementById("results").value = request;
}
</script>
But when I click on the button, the text that shows up in "results" is "[object Object]". Obviously, I'm looking for "Hello, Bob" to show up in "results" - any help would be appreciated.
