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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:10:40+00:00 2026-06-07T14:10:40+00:00

i have js function function addAllToCart(){ var have_result = false; jQuery(input#qty).each(function(indx, e){ if (e.value

  • 0

i have js function

function addAllToCart(){
    var have_result = false;
    jQuery("input#qty").each(function(indx, e){
      if (e.value != ''){
        //alert(indx);
        jQuery.get("/checkout/cart/add/", { product: e.name, qty: e.value }, {async: false},
             function(data){});
        have_result = true;
       }
    });

    if (have_result)
        document.location.href = "/checkout/cart/";

    return false;
}

it find on page all inputs with id qty, get it name and value and make ajax request to add to cart. there are many these inputs on on page, so i need to add all of them and then rediret to “/checkout/cart/”; but only first value adds to cart and then works redirect. how can i do redirect only after making all ajax requests??

  • 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-07T14:10:42+00:00Added an answer on June 7, 2026 at 2:10 pm

    here is the signature of jQuery.get

    jQuery.get( url [, data] [, success(data, textStatus, jqXHR)] [, dataType] )
    

    you don’t call the method correctly.

    Also, you should use post instead of get to add your items into session or db. Get does work in practice, you can get item information from query strings. but It’s just wrong doing it this way. you should use post

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

Sidebar

Related Questions

I have function: function get_playlist(){ var result = jQuery.ajax({ url: '<?php echo admin_url('admin-ajax.php'); ?>',
I have function like this: function update_List(){ LIST=[]; $.each(feed_urls,function(index,value){ $.getJSON(value, function(data) { $.each(data.feed.entry,function(i,val){ LIST.push(val.content.src);
I have: function send(){ $.get(/site/send.php, function(data){ alert(data); } } In site/send.php I have: sleep(1000)
i have function <script type=text/javascript> $(function () { $(#search).click(function() { var text = $(#searchText).val();
I have function source stored in a string eg.: var source=(function(){return Math.sin(x);}); I want
i have function: function getFieldNames(arrayOfRecords) { var theStuff; for (var i = 0; i
I have function to unlock data sets via an API function unlockData() { var
if I have: function init(t,y,u) { alert(t + + y + + u); }
hello i want i have function to get paragraph of selected text. this is
if i have function f(x,y,z), how to get first derivation of my function in

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.