Having trouble with MxData

4 views
Skip to first unread message

Lance

unread,
Sep 17, 2008, 7:09:19 PM9/17/08
to mxAjax
I have a small 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>

and a page that displays the results :

<html>
<head>
<title>Multiple coldfusion function call and Ajax.Update call</
title>
<cfoutput>
<script type='text/javascript' src='/mxAjax/core/js/prototype.js'></
script>
<script type='text/javascript' src='/mxAjax/core/js/mxAjax.js'></
script>
<script type='text/javascript' src='/mxAjax/core/js/mxSelect.js'></
script>
</cfoutput>
<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>

</head>
<body>


<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>

</body>
</html>


When Button 2 is pressed the expected result occurs but if Button 1 is
pushed I get a js error Object expected. Obviously I am doing
something wrong but I can't figure it out, any help would be very
apprieciated.
Reply all
Reply to author
Forward
0 new messages