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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:32:03+00:00 2026-05-31T16:32:03+00:00

I am trying to get a piece of data back using jQuery ajax via

  • 0

I am trying to get a piece of data back using jQuery ajax via a POST response, but I cannot seem to display the data. Here is the code that I am using.

$(document).ready(function(){
  $('#contentdiv').html(' ');
    $("#idm").change(function(){
      var formval = {idm:$(this).val()};
      $.ajax({
          type: "POST",
          url: "request_processor.cfm",
          dataType: "json",
          data: formval,
          success: function(response){
             $('#contentdiv').fadeIn(2000).append(response.DESCRIPTION);}
      });   
    });
 });

Here is the JSON I am getting back from the CFC.

{"DESCRIPTION":"Global Alpha I Benchmark"} 

Here is the code in request_response.cfm

<cfset oData = CreateObject("component","menudata")>
<cfset oData.setDataSource(dsn)>
<cfset theData = oData.getMenuData(FORM.idm)>
<cfset oJSON = createObject("component","cfjson")>
<cfset theResults = oJSON.encode(theData)>
<cfoutput>#theResults#</cfoutput>

What is the problem?

Thanks

  • 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-31T16:32:05+00:00Added an answer on May 31, 2026 at 4:32 pm

    Take a look at the response you get from your ajax request in the network tool in firebug or the chrome developer tools. Make sure you are only getting the JSON back and nothing else.

    If you are getting junk back before or after the JSON, then you need to restrict the output using cfsetting to prevent output other than the content between the cfoutput tags.

    You should try actually call a method on a CFC rather than making a call to cfm page and using the returnformat attributes on the function and/or the JSON functions built into ColdFusion.

    You should also make sure that your #contentdiv element is valid HTML. Have you looked at the source of the page once the response has come back? Is anything actually appearing in the DOM element you’ve given an id of “contentdiv”? If it is, then you have a CSS/javascript problem.

    You should make it visible in the CSS and only do the append call without the fade(). You need to make sure that the “contentdiv” is actually capable of being visible on your page. Once you’ve got the description displaying on the page, then reintroduce the fade(). However, the fade should be chained after the append and not before.

    To be honest, this is just debugging 101. Its not a direct answer, but hopefully you’ll find your own answer.

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

Sidebar

Related Questions

I'm trying to create a piece of code but cannot get it working. The
I'm trying to get this piece of script to work, but it keeps dying
I am trying get all html links within a string and replace them using
I am trying get all html links within a string and replace them using
I am trying get Struts 2 and Tiles to work and I am using
Trying to get parameters from a PUT request using HttpServlet#doPut: public void doPut(HttpServletRequest request,
Trying to get comfortable with jQuery and I have encountered some sample code that
I'm trying to get data from file. The file first has three lines of
I’ve been trying to get this to work for a while but can’t (I
I am using jQuery 1.4.3. I am trying to determine a best practice for

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.