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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:07:43+00:00 2026-05-15T19:07:43+00:00

I am using a third party shopping cart that sends a registration form to

  • 0

I am using a third party shopping cart that sends a registration form to a .cgi script.

I want to send information from that form to me, and the customer via a jQuery $.get() function call.

The $.get calls a registration.mail.php script.

The problem is that the form submitting seems to cancel out the ajax call before the ajax call can be completed.

I can think of some inelegant solutions, and I have decided, because I’m about to travel, to use a counter and make the user click ‘Register’ twice. This solution hurts my soul obviously.

Here’s the Javascript, that lives in the footer:

<script type="text/javascript">
var getsuccess = false;
$(document).ready(function() {

    $('form#registerWholesale').bind('submit', function() {

        $email = $('#email').val();
        $username = $('#contactname').val();
        $company = $('#company').val();
        $phone = $('#billphone1').val();

        $message = "A new customer has registered at the wholesale website. \n ";
        $message += "They have the username of: " + $username + ". \n";
        $message += "Their company is: " + $company + ". \n";
        $message += "Their email is: " + $email + ". \n";
        $message += "Their phone is: " + $phone + ". \n";
        $message += "Please help them ASAP. You can access the back end of the site at: http://location of website admin backend";

      $.get('/mail.php', {from: 'orders@OurCompany.com', message: $message, email: $email, username: $username, company: $company}, function(data, textStatus, xhr) {
         getsuccess = true;
      });

      if (getsuccess) {
        return true;
      }else{
        return false;
      }
    });


</script>

And here is the registration.mail.php code.

<?php

//Vendor email (to us)
$to = "ouremail@OurCompany.com";
$subject = "URGENT--New Registration--URGENT";
$message = htmlentities($_GET['message'], ENT_QUOTES, 'UTF-8');
//$message = $_GET['message'];
$from = htmlentities($_GET['from'], ENT_QUOTES, 'UTF-8');
//$from = trim($_GET['from']);
$headers = "From: $from";
mail($to,$subject,$message,$headers);
//echo "Mail Sent.";



//Customer email (to them)
$to_cust = htmlentities($_GET['email'], ENT_QUOTES, 'UTF-8');
$subject_cust = 'OurCompany Online Wholesale Account Request Recieved';
$message_cust = "Thank you for you interest in OurCompany's new wholesale website. \n\n
We have received your request to create an account.   In order to obtain a wholesale account, a OurCompany representative must verify your account information and details by telephone.  OurCompany will contact you within 1 business day at the telephone number that we have on file, or feel free to give us a call at 1-xxx-xxx-xxxx anytime if you would like a more rapid approval.  \n\n

Thanks Again ~ OurCompany";

$headers_cust = "From: orders@OurCompany.com";
mail($to_cust,$subject_cust,$message_cust,$headers_cust)
?> 

Thank you!

  • 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-15T19:07:44+00:00Added an answer on May 15, 2026 at 7:07 pm

    One solution is to bind the event to the button click , prevent the default action of the click so the form does not submit, then finally submit the form in the .get callback.

    N.B As Jaanus suggests you should really look at the app design and send the mail and save the cart in the same call. What happens if the email gets sent then the form submission action fails?

    $(document).ready(function() {
    
        $('#yourSubmitButton').click( function(ev) {
    
            //prevent form submission
            ev.preventDefault();
    
            $email = $('#email').val();
            $username = $('#contactname').val();
            $company = $('#company').val();
            $phone = $('#billphone1').val();
    
            $message = "A new customer has registered at the wholesale website. \n ";
            $message += "They have the username of: " + $username + ". \n";
            $message += "Their company is: " + $company + ". \n";
            $message += "Their email is: " + $email + ". \n";
            $message += "Their phone is: " + $phone + ". \n";
            $message += "Please help them ASAP. You can access the back end of the site at: http://location of website admin backend";
    
            $.get('/mail.php', {from: 'orders@OurCompany.com', message: $message, email: $email, username: $username, company: $company}, function(data, textStatus, xhr) {
    
               //all is well, submit the form
               $('#yourForm').submit()
    
           });
    
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a COM object from a third party library that generates periodic events.
We're using a third-party middleware product that allows us to write code in an
I'm using a third-party library that returns XML that is not valid, because it
I'm using a third party library that returns a raw Iterator, e.g. Iterator<?> children
I'm using a third party component that I call a method passing a model
I am trying to cleanup some Javascript code using jshint. In a third-party script
How can I detect keyboard event in C language without using third party libraries?
Without using any third party program to do this (i.e. without VMware ThinApp, U3
I am using a third party application and would like to change one of
I'm using a third-party library which accesses fonts through the GraphicsEnvironment: getAllFonts() call. This

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.