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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:27:35+00:00 2026-05-30T07:27:35+00:00

I have a form for a mailing list script which I am trying to

  • 0

I have a form for a mailing list script which I am trying to get working with ajax so the form can refresh without reloading. With the $.ajax part of the jquery commented out, the form variables are sent to the URL string.

?email=test%40address.com&sub=sub&submit=Submit+Form

My question is why is the submit=Submit+Form part there given that it isn’t part of my “datastring” and will that be a problem when it comes to processing the actual PHP script?

Here is the form :

<form name="email_list" action="">

<p><strong>Your Email Address:</strong><br/>
<input type="text" name="email" id="email" size="40">
<input type="hidden" name="sub" id="sub" value="sub">

<p><input type="submit" name="submit" value="Submit Form" class="email_submit"></p>
</form>

and the JQuery

$(function() {    
$('.email_submit').submit(function() { 

var email = $("input#email").val();  
            if (name == "") { 
            $("input#email").focus();  
            return false;
        }  
var sub = $("input#sub").val();  
            if (name == "") {  
            $("input#sub").focus();  
            return false;
        }       

var dataString = '&email=' + email + '&sub=' + sub;

//alert (dataString);return false;  
/*$.ajax({  
    type: "POST",  
    url: "mailing_list_add2.php",  
    data: dataString,  
    success: function() {  
        $('#display_block')                      
        .hide()  
        .fadeIn(2500, function() {  
            $('#display_block');  
        }); 
    }  
}); 
return false; 
});*/

}); 
  • 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-30T07:27:37+00:00Added an answer on May 30, 2026 at 7:27 am

    You should put the submit handler on the form, not on the button, even if is a submit button.

    <form name="email_list" action="" id="my_form">
    

    Update the javascript

    $(function() {    
      $('#my_form').submit(function() { 
        ...
      });
    });
    

    To serialize all the inputs into a string you could use $("#my_form").serialize() which builds a string with all the inputs and their data ready for posting:

    var dataString = $("#my_form").serialize();
    

    Also note that having a name attribute defined for the submit input means that its value will be sent also in the form. If you don’t need that, you can simply remove the name attribute.

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

Sidebar

Related Questions

I have a mailing list form I'm working on that is needing to have
Somehow, a simple form I have to sign up for a mailing list (which
I have a simple form for a mailing list that I found at http://www.notonebit.com/projects/mailing-list/
I'm trying to set up a simple form for a mailing list. And it
I have a form which will generate a report for mailing. The form opens
I have a form to signup yourself in a mailing list. I had set
I have successfully used ajax to refresh in-line, via ajax, a contact form. I'm
This is a mailing list script. It works by itself without jquery but I
I have form where user submits field. Field can have letters, numbers, and punctuation.
I have form, where some fields are looks like rows, so I can add/delete

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.