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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:13:06+00:00 2026-05-31T04:13:06+00:00

I have a CF page that has a CFdiv. The Cfdiv is bound to

  • 0

I have a CF page that has a CFdiv. The Cfdiv is bound to an element on the page. The main page contains the script. None of the script executes on elements in the CFdiv. There seems to be a problem with the ajax call. When I take that code out, the rest of the code seems to be enabled in Firebug but still will not execute.

<script type="text/javascript">
  $(document).ready(function () {
    $('#candidatesubmit').on('click', function () {
      $.ajax({
      type: 'POST',
      url: 'actEditStatusForm.cfm',
      data: 'form=',
      error: function (xhr, textStatus, errorThrown)(
      // show error 
      alert(errorThrown);),
      success: function (response1, textStatus, jqXHR)(
      alert('success');)
       });
    ColdFusion.Grid.refresh('candidatesGrid', true);
  });
  $(function () {$("#JDOrgChartRESOutlineSentToCand").datepicker({dateFormat: 'yy/mm/dd'});});
  $(function () {$("#IndepthWRec").datepicker({dateFormat: 'yy/mm/dd'});});
</script>
  • 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-31T04:13:08+00:00Added an answer on May 31, 2026 at 4:13 am

    First, you have some syntax errors. Perhaps this is just a problem as pasted above, and not in your real code. But make sure the body of your error and success functions are surrounded by curly brackets, not parentheses.

    So instead of this:

    error: function (xhr, textStatus, errorThrown)(
      alert(errorThrown);),
    

    You should have this:

    error: function (xhr, textStatus, errorThrown) {
      alert(errorThrown);
    },
    

    Second, your grid refresh is outside the success function of the ajax call. Since that call is asynchronous, the grid refresh is likely running before that call has completed. Move the refresh into your success callback function, like this:

    success: function (response1, textStatus, jqXHR){
      ColdFusion.Grid.refresh('candidatesGrid', true);
      alert('success');
    }
    

    Third, if the content of the cfdiv is being loaded asynchronously, and the #candidatesubmit element is inside that dynamically loaded content, your function will not be bound to its click event because it won’t be present when the main page’s ready event is triggered.

    So instead of directly binding to the element, use a delegation strategy by listening for events on an enclosing element that you know will be present in the initial page load. So instead of this:

    $('#candidatesubmit').on('click', function () {
    

    Try something like this:

    $('#some_outer_div').on('click','#candidatesubmit', function () {
    

    #some_outer_div will now be listening for any click events that bubble up from its descendant elements (even those that were not present when the page first loaded). If the target of one of those clicks is #candidatesubmit, the handler will fire.

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

Sidebar

Related Questions

I have a page that contains multiple checkbox input elements. Toggling these alter the
I have a page that has 50 elements with the same class fields which
I have a page that has a form backing object that contains a collections
I have a page that has an iframe From one of the pages within
I have a Page that has a single instance of a UserControl that itself
I have a page that has fields dynamically loaded via JQuery. It allows a
I have a page that has 2 columns of words, 20 total, that are
I have a page that has a bunch of user controls on it. I
I have a page that has a large image on it with a number
I have a page that has several ajax submission forms. Each form has a

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.