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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:46:18+00:00 2026-05-12T07:46:18+00:00

I am using Ajax with ModelGlue in a ColdFusion Application. I want to make

  • 0

I am using Ajax with ModelGlue in a ColdFusion Application. I want to make an Ajax call to return a value. I do not want to render any view. I just want a database interaction and bring back a value.

My Ajax call:

new Ajax.Request(root+'test.testFunction',{
  method: 'post',
  parameters: {param1:paramval},
  onSuccess: function(response){
    alert(response.responseText);
    var myresult = response.responseText;
  }
});

my modelglue event :

<event-handler name="test.testFunction">
     <broadcasts>
          <message name="testFunction" />
     </broadcasts>
</event-handler>

and my controller function:

<cffunction name="testFunction" returnType="any" output="true" >
     <cfargument name="event" type="any" required="true">
        <cfset justtest = 1>
     <cfreturn justtest>
</cffunction>   

I am using prototype as my ajax library.

When i alert the responseText i am getting null value. Is this bcoz i have not included the view part in the event handler? If i included the view part then i wud have to create a new page which i dont want to do. Is it possible to get just a server value by ajax call without rendering any view?
I want to have myresult value as 1 according to the above scenario.

Pls help. Thnx for any help.

  • 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-12T07:46:19+00:00Added an answer on May 12, 2026 at 7:46 am

    Try using this at the end of your controller function:

    <CFCONTENT TYPE="text" RESET="Yes"><CFOUTPUT>#serializeJSON(justTest)#
    <cfset request.modelGlueSuppressDebugging = true />
    <cfsetting showdebugoutput="false" /></CFOUTPUT><cfabort>
    

    So like this:

    <cffunction name="testFunction" returnType="any" output="true" >     
    <cfargument name="event" type="any" required="true">        
    
    <cfset justtest = 1>
    
    <CFCONTENT TYPE="text" RESET="Yes"><CFOUTPUT>#serializeJSON(justTest)#
    <cfset request.modelGlueSuppressDebugging = true />
    <cfsetting showdebugoutput="false" /></CFOUTPUT><cfabort>
    
    </cffunction>
    

    This will keep your current view and return ‘justTest’ as a json.

    If you are using firefox you should be able to see the reponse from the server.

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

Sidebar

Related Questions

I am using Ajax in java web application and i want to take the
I'm using AJAX with struts1.x, In my application once select the first select item
I am using Ajax Comboboxes in my application. The controls are re-created dynamically on
I'm using ajax to make a request on a servletand receive json String servlet
so currently using ajax with JQuery .post to return a form populate with some
I'm using Ajax to refresh a partial view and find that the ViewBag contents
Im using ajax .POST to run php script that suppose to return true/false. Im
Im using ajax to call php which gets results from a mysql db. Reason
I've been using ajax for a while now and I want to learn more
I have some problems using ajax with Spring MVC. I want to refresh only

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.