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

  • Home
  • SEARCH
  • 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 8512101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:11:26+00:00 2026-06-11T04:11:26+00:00

I have a page with a number of different forms generated from a database.

  • 0

I have a page with a number of different forms generated from a database. Each form has been given a div at the bottom to load data into. These have dynamic id: tempdiv_1 tempdiv_2 etc.

I am trying to get the jquery to work to update the divs based on something like this.input.val which is a hidden input with the section ID.

Code:

<script type="text/javascript">
$('#formdataAddForm').live('submit' , function() { // catch the form's submit event
   $.ajax({ // create an AJAX call...
        data: $(this).serialize(), // get the form data
        type: $(this).attr('method'), // GET or POST
        url: $(this).attr('action'), // the file to call
        success: function(response,data) { // on success..
            $.fancybox({
            maxWidth    : 800,
            maxHeight   : 200,
            fitToView   : false,
            width       : '70%',
            height      : '70%',
            autoSize    : false,
            closeClick  : false,
            openEffect  : 'none',
            closeEffect : 'none',
            content     : response
        });
        $('#tempdiv_'+(('input[id="formdataSection"]', form).val())).load('/page/list.php');
    }
});
return false; // cancel original event to prevent form submitting
});
</script>

The bit I can’t get to work is something along these lines:

 $('#tempdiv_'+(('input[id="formdataSection"]', form).val())).load('/page/list.php');

How can I get jquery to update a dynamic div? The forms all have the same ID so I cannot call form id.

  • 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-06-11T04:11:27+00:00Added an answer on June 11, 2026 at 4:11 am

    try this code:

     <script type="text/javascript">
       $('#formdataAddForm').live('submit' , function() { // catch the form's submit event
       var form = $(this)
       $.ajax({ // create an AJAX call...
            data: $(this).serialize(), // get the form data
            type: $(this).attr('method'), // GET or POST
            url: $(this).attr('action'), // the file to call
            success: function(response,data) { // on success..
                $.fancybox({
                maxWidth    : 800,
                maxHeight   : 200,
                fitToView   : false,
                width       : '70%',
                height      : '70%',
                autoSize    : false,
                closeClick  : false,
                openEffect  : 'none',
                closeEffect : 'none',
                content     : response
            });
            $('#tempdiv_'+($('input[id="formdataSection"]', form).val())).load('/page/list.php');
        }
    });
    return false; // cancel original event to prevent form submitting
    });
    </script>
    

    If code in you question is the same you are trying to run – that should help. In your code form variable is not defined and you missed $ in this line: $('#tempdiv_'+($('input[id="formdataSection"]', form).val())).load('/page/list.php');

    Besides, it would be really better if you will use name attribute instead of id for inputs where you store div id. ID must be unique and name – no. Suppose form context (second parameter in $('input[id="formdataSection"]', form)) should help to find correct value (as I remember, I’ve been trying something like that successfuly), but names are more reliable and valid.

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

Sidebar

Related Questions

I have a php page which has multiple form tags. each form is dealing
I have an asp.net web page created with web forms. It has a number
I have a page that has a large image on it with a number
So on a specific page I have some number of form elements, anywhere between
I have a page in JQuery mobile, which contains a form. The form has
I have a number of different php-forms(25) that will handle some information. Instead of
I have a search form that offers a number of different search options, such
I have a JSF page with two forms (pseudo-code below). First form is for
I have two tables, one contains the page/heading number and the heading text, the
I have a dynamic page that gets a certain number of results for rooms

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.