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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:31:59+00:00 2026-05-27T10:31:59+00:00

I am submiting a form which adds a new item to a table as

  • 0

I am submiting a form which adds a new item to a table as well as updates a total value. The form is in a jquery dialog and below is the buttons option specified.

                buttons: {
                    Save: function() {
                        $.post(mysaveurl , $("#fee_form").serialize(),
                            function(data) { 
                                var $mydata= $(data);
                                var newremovefeeurl = "${removefeeNoIds}" + $mydata.find("td:last").attr("id");
                                $mydata.find("td:last").attr("id", newremovefeeurl);
                                $( "#totalfees" ).before($mydata);  
                                enablespinner();
                                var mynewtotal = parseFloat($("#total").text()) + parseFloat($mydata.find(".cost").text());
        $("#total").empty().html(mynewtotal).toFixed(2);

       alert($("#total").text());           
       //var mynewtotalurl = $("#total").attr("updateurl");
       //$.post(mynewtotalurl , { newtotal: $("#total").text() } );
                            }                           
                        );
                        $( this ).remove();
                    }

The post simply adds a new table row to an existing table and updates the value stored inside the element with ID “total”. No problem so far.

After reseting the “total” value with mynewtotal in the code. I the proceed to alert the contents of “total” which should be the new updated value. Insted, I get the old value even after it was updated.

I want to do another post as indicated by the commented code above.

please advise.

  • 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-27T10:32:00+00:00Added an answer on May 27, 2026 at 10:32 am

    It looks like:

    $("#total").empty().html(mynewtotal).toFixed(2);
    

    should be

    $("#total").empty().html(mynewtotal.toFixed(2));
    

    so that you’re operating on the total, not the return of the jQuery function.

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

Sidebar

Related Questions

Say, you are submitting a form, which affects your database (adding records/ deleting them/
In my application am submiting my form by using post for a php page.
I have a form I am submitting using jQuery's ajaxSubmit function from the Forms
I have a form which I want to submit only if a condition is
I have a multi-step form in which i have to choose an image in
i have a django form which generates the qrcode, the form does show up
I did see this post which lead me to the UI/API/1.8/Dialog I'm looking for
i'm using jquery tabs.. i'm use tabs-1 as input form and tabs-2 as show
I am having a form in which i have applied the javascript validations, but
*Hi , I am very new to using JSON in Jquery. I have 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.