Copy link to clipboard
Copied
I have been using cfajaxproxy for a few weeks only, as I was training for it, the examples I've tried all worked. However, now as I'm working on a real application I keep getting an error of "exception thrown but not caught"? Heres is my code if anyone can guid me to the right direction:
rem.cfc:
<!-- function to check if friend or not -->
<cffunction name="checkname" access="remote" returntype="numeric">
<cfargument name="ref" type="numeric">
<cfquery name="checkfriend" datasource="blog">
SELECT friendshipid FROM friends WHERE
UserID = #SESSION.IsLoggedIn.UserID#
AND FriendID = #ARGUMENTS.ref#
</cfquery>
<cfreturn int(checkfriend.recordcount)>
</cffunction>
and here is my script:
<cfajaxproxy cfc="rem" jsclassname="rem"/>
<script>
function checkname(name){
var instance = new rem();
instance.setCallbackHandler(isfriend);
instance.setForm('nameform');
instance.checkname(name);
}
function isfriend(res){
if (res == 0)
ColdFusion.Window.show("addf");
else{
var locate = "test2.cfm?rel=";
window.navigate(locate + name);}
}
</script>
Yet, if my code is right, how can I avoid using cfajaxproxy and go on with using ajax myself connecting to my methods and functions. Because at this point all my ajax that has been built on cfajaxproxy does NOT work.
thank you everyone
Copy link to clipboard
Copied
Ali,
Are you looking to 'dump' the built-in CF Ajax functions and use an alternate library (i.e., jQuery, Prototype, etc.)? Or are you looking to still use some/all of the CF Ajax code? Wasn't 100% sure from the OP.
Cheers,
Craig
Copy link to clipboard
Copied
I'm sorry if I didnt make that clear I want to get the results back from the query. The query gives back a result of 1 or 0, and I want that number to returned to the setCallbackHandler, and then either a cfwindow opens, or it takes the user to that persons page. Now, I want cfajaxproxy to work as it should not to just dump any thing. And I was asking if my code is right, and theres something wrong with my cfajaxproxy tag files on the server, how can I accomplish that without the use of it. But if im doing something wrong, then ill just fix it
Thank you
Ali