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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:05:41+00:00 2026-05-25T23:05:41+00:00

I have a multi-form app that gathers some information via AJAX and then allows

  • 0

I have a multi-form app that gathers some information via AJAX and then allows the user to update that information and submit it again while continuing through the form.

The goal is to eliminate multiple pages to perform simple record updates.

My jQuery .post() returns the ‘new’ form with new values, but my second form does not submit the returned values, even the ‘delete’ returns either object.HTMLElement or undefined.

Please help, as I’m a jQuery newbie.

index.php

<form id="getCustomer">
    <select>
        <option value="1">John Doe</option>
        <option value="2">Jane Doe</option>
    </select>
</form>
<div id="customer_info">
    <form id="updateCustomer">
        <input type="text" name="firstName" value="" />
        <input type="text" name="lastName" value="" />
        <input type="submit" id="updateCustomer" value="Update" />
        <input type="submit" id="deleteCustomer" value="Delete" />
    </form>
</div>
<div id="info_status"></div>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
    //AJAX selected customer
    $('#getCustomer').change(function(){
    var id = $(this).val();
        $.post(
            'inc/getCust.inc.php',
            {id:id},
            function(output){
                $('#customer_info').html(output).show();
        });
    });
    //Prevent default form actions
    $('form').live('submit', function(){
        return false;// On submit return false
    });

    //AJAX Update Customer
    $('#updateCustomer').live('click', function(){
        var fname = $('input[name=firstName]').val();
        var lname = $('input[name=lastName]').val();
        $.post(
            'inc/updateCust.inc.php',
            { },
            function(output){
                $('#info_status').html(output).show();
        });
    });
    //AJAX Delete Customer
    $('#deleteCustomer').live('click', function(){
        var fname = $('input[name=firstName]').val();
        var lname = $('input[name=lastName]').val();
        var deleteCust = confirm('Delete: ' + c_fname + ' ' + c_lname + '?');
        if(deleteCust){
            $.post(
                'inc/deleteCust.inc.php',
                { id:id },
                function(output){
                    $('#info_status').html(output).show();
                }
            );
        }
    });
</script>

getCust.inc.php

<?php getCust($_POST['id']);?>
<form id="updateCustomer">
    <input type="text" name="firstName" value="<?php echo $CUST['fname'];?>" />
    <input type="text" name="lastName" value="<?php echo $CUST['lname'];?>" />
    <input type="submit" id="updateCustomer" value="Update" />
    <input type="submit" id="deleteCustomer" value="Delete" />
</form>
  • 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-25T23:05:42+00:00Added an answer on May 25, 2026 at 11:05 pm

    So, I was unable to resolve the usage of $('input[name=firstName]').val();

    However, after some modification $('#firstName').val(); is working.

    Final Working index.php code:

    <form id="getCustomer">
        <select>
            <option value="1">John Doe</option>
            <option value="2">Jane Doe</option>
        </select>
    </form>
    <div id="customer_info">
        <form id="updateCustomer">
            <input type="text" id="firstName" value="" />
            <input type="text" id="lastName" value="" />
            <input type="submit" id="updateCustomer" value="Update" />
            <input type="submit" id="deleteCustomer" value="Delete" />
        </form>
    </div>
    <div id="info_status"></div>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
        //AJAX selected customer
        $('#getCustomer').change(function(){
        var id = $(this).val();
            $.post(
                'inc/getCust.inc.php',
                {id:id},
                function(output){
                    $('#customer_info').html(output).show();
            });
        });
        //Prevent default form actions
        $('form').live('submit', function(){
            return false;// On submit return false
        });
        //AJAX Update Customer
        $('#updateCustomer').live('click', function(){
            var fname = $('#firstName').val();
            var lname = $('#lastName').val();
            $.post(
                'inc/updateCust.inc.php',
                { },
                function(output){
                    $('#info_status').html(output).show();
            });
        });
        //AJAX Delete Customer
        $('#deleteCustomer').live('click', function(){
            var fname = $('#firstName').val();
            var lname = $('#lastName').val();
            var deleteCust = confirm('Delete: ' + fname + ' ' + lname + '?');
            if(deleteCust){
                $.post(
                    'inc/deleteCust.inc.php',
                    { id:id },
                    function(output){
                        $('#info_status').html(output).show();
                    }
                );
            }
        });
    </script>
    
    • 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 multi-level ajax form on my rails app that can
I have some code that uses a multi-part form and HTML5 file object to
I have the following multi-select box in a HTML form, where user can select
I have a multi-step form and user can navigate to any page to modify
I have a large multi-directional form that validates almost all fields with Jquery Validator,
In my current .NET and FBML-based facebook app, I have some code that looks
I have a multi-module app that is already on Github. It is comprised of
I have a multi-step Rails 3 form that I set up using this railscast:
I have a multi-part form where pressing either Back or Next will cause that
I have a multi-page form, and I'm trying to implement Back buttons, so that

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.