Lance
unread,Sep 17, 2008, 5:59:20 PM9/17/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mxAjax
I am new at mxAjax and trying to get mxData to work. Here is my code:
<cfset ajaxUrl = "http://"&cgi.server_name&":"&cgi.server_port&"/
shared/cfc/ajaxTest2.cfc">
<script language="javascript">
var url = "<cfoutput>#ajaxUrl#</cfoutput>";
function clickTrack(){
alert('firing');
new mxAjax.Data({
executeOnLoad: true,
paramArgs: new mxAjax.Param(url,{param:"clickObj='button 1 was
pushed'", httpMethod:"post", cffunction:"enterSiteStat"}),
postFunction: handleData,
errorFunction: sayError
});
alert('firing complete');
}
function handleData(response){
alert(response);
}
function sayError(){
alert('error');
}
</script>
<h1>Test mxData</h1>
<form name="myForm" action="mylookup.cfm" method="post">
<input type="button" name="process" value="button 1"
onClick="clickTrack()"><br>
<input type="button" name="process2" value="button 2" onClick="new
Ajax.Updater('divResponse', url + '?
method=init&function=enterSiteStat&clickObj=button 2 was
pushed&htmlResponse=true')"><br>
</form>
<div id="divResponse"></div>
Here is the cfc :
<cfcomponent extends="mxAjax.core.cf.mxAjax" output="false">
<cfapplication name="mxAjax" sessionmanagement="true">
<cffunction name="enterSiteStat" access="public" output="false"
returntype="string">
<cfargument name="clickObj" type="string" required="false"
default="">
<cfreturn arguments.clickObj/>
</cffunction>
</cfcomponent>
If I press Button 2 I get the ecpected result but if I press Button 1
I get a js error: Object expected
I have been trying to figure this out for hours and I know there s
something simple I am missing. Any help is appriciated!