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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:52:14+00:00 2026-05-25T18:52:14+00:00

So I have an app that submits a form to an external cart using

  • 0

So I have an app that submits a form to an external cart using Javascript (target is blank) then I want the window to navigate to a Rails controller to create a small tracker model, controller as such:

def add_to_cart
    @product = Product.find(params[:id])
    @product.cart_trackers.create
    redirect_to :back
end

And the Javascript (in a link_to, onclick helper):

document.forms['addCart#{product.id}'].submit();
window.location.href=\"/products/add_to_cart/#{product.id}\";
return false;

And this works wonderfully in Firefox and Internet Explorer, but Google Chrome throws a fit about so much navigation. I realize AJAX could be a worthy solution, but due to the environment this app runs under (which is a clustercrap of Prototype, Jquery, iFrames, and includes) I’d like to avoid it if possible. Chrome’s response is to actually run the window.location… code and skip the form submitting. Without one or the other lines of code, Chrome will perform the single action just fine.

So, what would be the proper way of writing this out? Or should I give in and just wrangle in some AJAX?

  • 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-25T18:52:15+00:00Added an answer on May 25, 2026 at 6:52 pm

    Try using AJAX-but-not-really-AJAX. Submit the form using whatever AJAX submitter you want (e.g., $.ajax), but don’t do anything with the response (i.e., no callback). That way the data gets POSTed and maybe the browser won’t be upset that you’re asking it to visit two urls back-to-back.

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

Sidebar

Related Questions

I have some javascript that submits to an HTML form in my app upon
I have a form that submits data to a database in a CodeIgniter app
I have an app that is using standard out of the box form validation
I have an app that needs to open a new window (in the same
I have a app that I'm deploying to a development server using Capistrano. I'd
I have an App that will send authenticated emails using System.Net.Mail and System.Net.NetworkCredential my
I have an Ajax form in my Rails app that contains the Recaptcha markup
I have a Windows/Apache2/PHP app that receives file using chunked encoding. The reason is
I have an iPad app that submits orders to an ASP.NET MVC web site
I have an ASP.NET MVC3 app that features a form with a nested-table input

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.