I have a problem with JavaScript inputting 2 more fields
Guys, I am started in programing,
Would you be kind to help with this:
I have subscription script, and beside email I want to input 2 more fields where people will put their name and country, and all that to be submitted into subscription file.
- self.$container.on("click", ".ssCountdownSubscribeSelector", function(e){
- if (e && e.preventDefault) {
- e.preventDefault();
- }
-
- var $this = $(this),
- $form = $this.closest('form'),
- $emailAddress = $form.find("input[name='email_address']"),
- $errorContainer = $form.find(".ss-error-container");
- $errorContainer.css({"color": "#FF0000"}).html("").hide();
- if($emailAddress.val() == "") {
- $errorContainer.html("Please fill in your email address.").fadeIn();
- }
- else {
- var re = /([0-9a-zA-Z\.\-\_]+)@([0-9a-zA-Z\.\-\_]+)\.([0-9a-zA-Z\.\-\_]+)/,
- email_address = $emailAddress.val();
- if(email_address.match(re) == null) {
- $errorContainer.html("Invalid email address.").fadeIn();
- }
- else {
- $.ajax({
- type: "POST",
- data: {
- email: email_address
- },
- url: "subscribe/subscribe.php",
- success: function(){
- $emailAddress.val("");
- $errorContainer.css({"color": "#39F"}).html("Thank you for subscribing.").fadeIn();
- setTimeout(function(){
- $errorContainer.css({"color": "#FF0000"}).html("").hide();
- }, 3000);
- }
- });
- }
- }
-
- return false;
- });