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 7584509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:56:19+00:00 2026-05-30T18:56:19+00:00

I have a ColdFusion session variable that’s a structure of data. My goal is

  • 0

I have a ColdFusion session variable that’s a structure of data. My goal is to execute a jQuery call that does one of two things via Ajax:

  1. sends that ColdFusion structure to a ColdFusion component method, updates an element of that structure with a newly created string, and returns that same structure back.

or

  1. executes a ColdFusion component method that creates a new string, returns that string, and assigns that new string to an element of that same ColdFusion session structure after the Ajax call.

I would think it’d be easy, but I’ve been having some problems. Anybody know what I would need to do?

  • 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-30T18:56:21+00:00Added an answer on May 30, 2026 at 6:56 pm

    Well, the CF session structure and jQuery operate in two different spheres – CF on the server and jQuery in the browser. In order to “send that ColdFusion structure to a [cfc]…” from Ajax, you’ll have to have serialized the session structure as a json string and then transmitted that json string to the client somehow. Most likely, you’ll want to do this as part of the rendering of the page to the client:

    <cfoutput>var jsonStruct = #SerializeJSON(session.myStruct)#;</cfoutput>
    

    Then you can use the jsonStruct variable from your jQuery code as needed (as a real JS object). When you need to send it back to CF, you can serialize it again on the Javascript side, like so:

    $.ajax({
       url: "foo.cfc?method=myMethod", 
       dataType: "json",
       data: {myStruct: JSON.stringify(jsonStruct)}, 
       success: function (respJSON) {
          jsonStruct = respJSON;
       }
    });
    

    Note that you should include json2.js to do the serialization, since some browsers coughIEcough don’t support JSON.stringify() natively.

    Update

    I’ve updated the example jquery code to show how you can update the javascript object to use the response from the CFC. To work properly, your CF will need to look something like this:

    <cffunction name="myMethod" access="remote" returnFormat="json">
      <cfargument name="myStruct" type="string">
    
      <cfset var realStruct = DeserializeJSON(arguments.myStruct)>
    
      <cfset session.myStruct = realStruct><!--- or whatever you want to do with it at this point --->
    
      <cfreturn session.myStruct>
    </cffunction>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ColdFusion script that does: <cfset content = replace(content,&##147;,,all)> Which replaces &147;
I have an application that uses coldfusion's session management (instead of the J2EE) session
Does Coldfusion have a Global structure where the expressions global[FORM] , global[URL] , global[APPLICATION]
I have a ColdFusion function foo which takes three args, and the second two
I have started design of a ColdFusion application that is entirely web based. Not
I have been tasked with going through a number of ColdFusion sites that have
Alright so this is an odd one... I have an application built in ColdFusion
We have a voting mechanism that we want to restrict to only allow one
I have the following Coldfusion process: My code makes a database call to the
I have a ColdFusion cfm file that communicates with a sql server database. Right

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.