javascript - Custom form integrated with Google Forms does not capture data -


i have set custom html & javascript form integrates google forms capture data. doesn't work @ moment though, data not sent @ times.

$(document).ready(function () {    function validateemail(email) {          var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/;          return re.test(email);      }        function posttogoogle() {                  var fname = $('#fname').val();                  var lname = $('#lname').val();                  var email = $('#email').val();                  var mobile = $('#mobile').val();                  var answer = $('#answer').val();                    if ((fname !== "") && (lname !== "") && (email !== "") && (mobile !== "") && ((answer !== "") && (validateemail(email)))) {                      $.ajax({                          url: "https://docs.google.com/a/forms/d/xxxx/formresponse",                          data: {"entry.1475885094" : fname, "entry.1313744185" : lname, "entry.710517602" : email, "entry.2041953514" : mobile, "entry.1669156751": answer},                          type: "post",                          datatype: "xml",                          statuscode: {                              0: function() {                                  alert("thank entry");                              },                              200: function() {                                  alert("thank entry");                              }                          }                      });                  }              }                             $(document).ready(function(){                  $('#entryform').submit(function() {                      posttogoogle();                      return false;                  });              });  });
<div id="entryform" class="contact-us-form">      <form id="callus" target="_self" onsubmit="" action="">          <fieldset>              <label for="fname">first name:</label>              <input id="fname" type="text" name="fname" class="input_field form__input__text">          </fieldset>          <fieldset>              <label for="lname">last name:</label>                  <input id="lname" type="text" name="lname" class="input_field form__input__text">          </fieldset>          <fieldset>              <label for="email">email:</label>              <input id="email" type="text" name="email" class="input_field form__input__text" placeholder="youremail@email.com">          </fieldset>          <fieldset>              <label for="mobile">mobile number:</label>              <input id="mobile" type="text" name="mobile" class="input_field form__input__text" placeholder="e.g. 0123456789">          </fieldset>          <fieldset>              <label for="answer">answer:</label>              <input id="answer" type="text" name="answer" class="input_field form__input__text" placeholder="e.g. 5">          </fieldset>          <div style="width: 100%; display: block; text-align: center;">              <button id="send" type="submit" class="btn--orange btn--big buy_btn oosbutton">                  submit              </button>          </div>          <div style="width: 100%; display: block; float: right; padding-top: 15px;">              <div class="requestsubmited" style="display:none; text-align: center;">your entry has been sent!</div>          </div>      </form>  </div>

there must wrong javascript. appreciate help


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -