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

The Archive Base Latest Questions

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

When user clicks a submit button, the script modifies a shopping cart printed on

  • 0

When user clicks a submit button, the script modifies a shopping cart printed on the page. However, if the user clicks it again, it will add the same line’s again, and I need to stop it.

So I only want the script to modify the contents of the page only once, and do nothing if the contents have already changed.

Here’s what I’ve tried:

$(document).ready(function () {
    $(function () {
        $(".submit").click(function () {
            var a = $('.simpleCart_input').val();
            var a1 = $('.simpleCart_input').val();
            if (a1 == a + " kpl") {
                return false;
            } else {
                $('.itemRow .item-quantity').text(a + " kpl");
            }
            var b = $('.itemRow .item-price').html();
            var b1 = $('.itemRow .item-price').html();
            if (b1 == b + " /kpl") {
                return false;
            } else {
                $('.itemRow .item-price').text(b + " /kpl");
            }
            var c = $('.itemRow .item-total').html();
            var c1 = $('.itemRow .item-total').html();
            if (c1 == "Yhteensä: " + c) {
                return false;
            } else {
                $('.itemRow .item-total').text("Yhteensä: " + c);
            }
            var d = $('.simpleCart_grandTotal').html();
            var d1 = $('.simpleCart_grandTotal').html();
            if (d1 == "Tuotteet yhteensä " + d) {
                return false;
            } else {
                $('.simpleCart_grandTotal').text("Tuotteet yhteensä " + d);
            }
            var data = $('#yhteystiedot').serializeArray();
            data.push({
                name: 'cartContent',
                value: $('#emailedcart').html()
            });
            //alert (data);return false;
            $.ajax({
                type: "POST",
                data: data,
                url: "order/order.php",
                dataType: "html",
                error: function () {
                    alert("Jotakin meni pahasti pieleen! Yritä uudelleen?");
                },
                success: function () {
                    alert("Onnistui");
                }


            });
            return false;

        });
    });
});

This just won’t work for me.

Sample

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

    something like that should work:

    $(document).ready(function () {
        var gDone = false;
        $(".submit").click(function () {
            if (gDone) return false; // already submitted
            gDone = true;
            // ...
        });
    });
    

    EDIT: it’s more user friendly to deactivate or hide the submit button

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

Sidebar

Related Questions

I want my recaptcha to appear only after user clicks submit button on the
When a user clicks a submit button I want the form to be submitted.
If the user manually clicks the 'submit' button, i use this code: if (isset($_POST['submit_findall']))
I have an HTML page with a simple form. When the user clicks submit,
It's supposed to display 172-ajax-include.php when the user clicks the submit button. But it
I am opening up a new page when the user clicks submit. It would
What I want to do is when user clicks a submit button, the backend
I have a form, when the user clicks on the submit button this javascript
I have some jquery to hide the submit button when the user clicks to
I have a textarea, and a submit button. When a user clicks outside of

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.