cfajaxproxy help..
I have trouble getting ajax to work on my application. I am using cfajaxproxy tag and I keep getting an error of "exception thrown but not caught". I am trying to get results back from the server of the query's recordcount. if its 0 then relocate the user, if its 1 then open a cfwindow..
heres my code:
<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>
and here is my 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>
thank you everyone