Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6318305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:37:27+00:00 2026-05-24T15:37:27+00:00

I am using ColdFusion 9 and jQuery. I am using CFAJAXPROXY. I have am

  • 0

I am using ColdFusion 9 and jQuery. I am using CFAJAXPROXY.

I have am having trouble accessing the data returned to a jQuery object.

This is part of my jQuery code:

var jro = new jsApp();
NewUser = jro.addUser(NewEmail);

The method in the CFC is addUser. I pass in an Email address (NewEmail) and I get the new user’s UserID back.

This query in the CFC works just fine:

<cfquery name="GetUserID">
SELECT      MAX(UserID) as MaxID
FROM        Users
</cfquery>

When I hard code a value like this, I do not have a problem:

<cfset NewUser = 10>
<cfreturn NewUser>

When I try to use a dynamic variable like this, I get a JSON error:

<cfset NewUser = GetUserID.MaxID>
<cfreturn NewUser>

This error seems to occur in the CFC. Hard coding the return variable works, but returning a single integer from a query does NOT work.

How do I return a single integer from a query? Why is this creating a problem?

Here is the how the CFC is called.

$("#AddUserSave").click(function() {
  NewEmail = $("#NewEmail").attr("value");
  var jro = new jsApp();
  UserID = jro.addUser(NewEmail);
  $("#UserDiv").load("GlobalAdmin/EditUser.cfm?UserID="+UserID);
});

Again, the CFC refuses to return the UserID from the database, but gladly returns a hardcoded number.

Okay, in my CFC this works:

<cfset NewUser = GetUserID.UserID>
<cfset NewUser = 1>
<cfreturn NewUser>

But this does NOT work:

<cfset NewUser = GetUserID.UserID>
<cfreturn NewUser>

Firebug says:

parseJSON throw new SyntaxError("parseJSON"); 
cfajax.js (line 803)

Okay, when I access this method via the browser, it shows an integer being returned.

 <!--- GET MAX USER --->
 <cffunction name="getMaxUser" access="remote" returnformat="plain" returntype="any">
    <cfquery name="GetUserID">
        SELECT  MAX(UserID) AS MaxID
        FROM    Users
    </cfquery>
    <cfreturn createObject( 'java', 'java.lang.Integer' ).init( javaCast( 'int', GetUserID.MaxID ) ) />
</cffunction>

When I view the page source, the maxid is 1 (one / an integer).

The CFC is being called with in JavaScript:

    var jro = new jsApp();
    jro.getMaxUser();

The exact error I am getting can be viewed on this screen shot:

http://evikjames.com/IMAGEs/parsejson.png

And here’s an image of my CFCs.

http://evikjames.com/images/CFC.png

Here’s an image of the URL created by JavaScript to access the method:

http://www.evikjames.com/images/error-2.png

+++++++++++++++++++++++++++++++++++++++++++++++++++++
ANSWER

The JavaScript needs to create a request that sets the return format to plain. I guess its default return type is JSON. The CFC chokes on the JSON that it own self has created.

var jro = new jsApp();
jro.setReturnFormat('plain');
UserID = jro.getMaxUser();

Hats off to Charlie for seeing this through. I am forever grateful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T15:37:27+00:00Added an answer on May 24, 2026 at 3:37 pm

    As per our chat, you need your remotely accessible method to return an integer, not a float.

    With credit to http://www.threesources.com/archives/009007.html, you need to do the following:

    1) specify returnFormat = “plain” (which I believe you’ve done)

    2) <cfreturn createObject( 'java', 'java.lang.Integer' ).init( javaCast( 'int', GetUserID.MaxID ) ) />

    As per the site linked to above, the reason is, “ColdFusion’s Numeric type maps to a double in the automatically generated RPC WSDL”.

    That site lists 5 steps that need to be taken, but I was able to successfully return an integer by just doing the 2 steps listed above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ColdFusion (Railo 3.3), and I have several forms using jQuery that
I'm using coldfusion and jquery. This is my first real go at jquery and
I am using this jquery ui autocomplete but i need to grab the data
I have this HTML: <input type=text id=query data-source=whatever> I have some jQuery that changes
I have a webservice programmed in coldfusion which I'm attempting to consume using c#.net.
I have a web application, written in ColdFusion, which periodically starts using 100% of
I am using this new jQuery plugin called jsTree www.jstree.com and using the HTML
I have a javascript object: data = { color: red, day: monday, list: {1,2,3,4,5,6}}
I'm looking into using Jquery to replace some of our native Coldfusion ajax functionality.
When using ColdFusion ORM where you have several tables with relationships can I bind

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.