• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfajaxproxy help..

Guest
Jun 26, 2009 Jun 26, 2009

Copy link to clipboard

Copied

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

TOPICS
Advanced techniques

Views

779

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2009 Jun 28, 2009

Copy link to clipboard

Copied

I would, for a start, define the functions as follows:

var checkname = function(name) {...}
var isfriend = function(res) {...}

and I would call setErrorHandler, for example, like this

instance.setErrorHandler(someErrorHandler)

Check out the live docs on cfajaxproxy

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 28, 2009 Jun 28, 2009

Copy link to clipboard

Copied

LATEST

Hi,

Thank you for the reply, but it didn't work. In fact, I thought it had somthing to do with the built in ajax files on the server, yet, when I moved both my document and the cfc to a new location on the server, magic happened and it all worked out just perfect. So, I really don't know what happened exactly, but I'm sure that it has to do with the cfajax.js files on the server some how. I would like to thank you again for the reply

Ali

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation