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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:32:49+00:00 2026-06-13T07:32:49+00:00

I wish to use forms to input data to an e-commerce cart I use,

  • 0

I wish to use forms to input data to an e-commerce cart I use, but wish to do this without the page refreshing after the user clicks the ‘add to cart’ button from the form. I have found many examples of submitting a form without a page refresh using jquery eg:
Submit A Form Without Page Refresh using jQuery
however have been unable to get this to work despite trying a few different solutions.

My form:

<form method="POST" id="formname">
<input name="userid" id="userid" value="00000000" type="hidden">
<input name="product" id="product" value="product name" type="hidden">
<input name="price" id="price" value="1.00" type="hidden">
<input name="qty" id="qty" value="1" type="hidden">
<input name="nocart" id="nocart" value="1" type="hidden">
<input name="units" id="units" value="1" type="hidden">
<input name="scode" id="scode" value="xxxx" type="hidden">
<input name="hash" id="hash" value="xxxxxxxx" type="hidden">
<input name="return" id="return" value="http://www.returnaddresshere" type="hidden">
<input type="submit" value="Add to cart">
</form>

and the script:

<script src="jquerylocation.js"></script>
<script>
$(document).ready(function(){
$("form#formname").submit(function(event) {
    event.preventDefault();
    var userid = $("#userid").val();
    var product = $("#product").val();
    var price = $("#price").val();
    var qty = $("#qty").val();
    var nocart = $("#nocart").val();
    var units = $("#units").val();
    var scode = $("#scode").val();
    var hash = $("#hash").val();
    var return = $("#return").val();

    $.ajax({
        type: "POST",
        url: "http://ww#.aitsafe.com/cf/add.cfm",
        data: "userid=" + userid + "&product=" + product "price=" + price + "&qty=" + qty "nocart=" + nocart + "&units=" + units "scode=" + scode + "&hash=" + hash + "&return=" + return,
        success: function(){alert('order added to cart');}
    });
});
});
</script>

I am not sure where the problem lies as I’m very new to javascript and jquery. All the examples I have seen use php as well to handle the input from the forms; would the fact that the e-commerce uses coldfusion require a different approach?

Thank you in advance your help.

  • 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-13T07:32:50+00:00Added an answer on June 13, 2026 at 7:32 am

    url: "http://ww#.aitsafe.com/cf/add.cfm", is the culprit here
    You cannot send an Ajax Request to another domain than the other on which your application is deployed. This is because of the Same Origin Policy implemented in web-browers — a security measure.

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

Sidebar

Related Questions

I wish to use the Translator classes of Zend framework in my app, but
I have two stored procedures I wish to use in my stored procedure, but
I've developed a user-control class which i intent to use for buttons . After
I have a requirement where I HAVE TO use bootstrap autocomplete dropdown, BUT user
I have a generic 'form page' user control that we use that allows editors
I wish to use the method with the following signature: exec(String command, String[] envp,
I wish to use Spring MVC to provide a REST web service. However, running
I wish to use a COM dll in my C++ library. The way I
I wish to use common CRC logic in a VB.NET or C# application as
I wish to use JSON.Net on a brand spankin new Mono class library (say

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.