I was wondering if I can call cffunction
on my cfm page? I have onClick
button that should make a call to the cffunction
that is on the same page. Also I have tried to put cfcomponent
around my function but I was getting this error:
Invalid CFML construct found on line 94 at column 1.
ColdFusion was looking at the following text:
<
The CFML compiler was processing:
< marks the beginning of a ColdFusion tag.Did you mean LT or LTE?
So far I have this:
<cffunction name="getRecords" access="remote">
<script>
alert('test');
</script>
</cffunction>
here is my JS Function:
function getRecs(){
try{
location.href = 'myCFMpage.cfm?method=getRecords';
}catch(err){
alert('Error')
}
}
I'm not sure if this even possible, my current code did not trigger alert in cffunction
. Reason why I'm trying to do this because I have a cfquery
on this page and I want to grab the data from that query when user click on the button and then to do some manipulation. If anyone can tell me if this is possible or is there any better way to approach this problem please let me know.