Untitled-1.js 1.76 KB
  <script type="text/javascript">
    function floorplan_form(event) {
      var name = jQuery('input[name="name"]').val();
      var email = jQuery('input[name="email"]').val();
      var mobile = jQuery('input[name="phonenumber"]').val();
      var formname = jQuery('input[name="formname"]').val();
      var utmsource = jQuery('input[name="utm_source"]').val();
      var utmmedium = jQuery('input[name="utm_medium"]').val();
      var utmcampaign = jQuery('input[name="utm_campaign"]').val();
      var utmcontent = jQuery('input[name="utm_content"]').val();





      $.ajax({
        url: 'https://docs.google.com/forms/d/e/1FAIpQLSeDq16qoqjG3AFO_qnAKats8BPTtl7qLiwQFeM8SICj2NNxVA/formResponse',
        type: 'POST',
        data: {

      "entry.1866747040=" . urlencode($name);
      "&entry.391332552=" . urlencode($mobile);
      "&entry.1319169842=" . urlencode($email);
      "&entry.380527525=" . urlencode($formname);
      "&entry.1619886954=" . urlencode($utmsource);
      "&entry.1888285929=" . urlencode($utmmedium);
      "&entry.731420388=" . urlencode($utmcampaign);
      "&entry.1910662605=" . urlencode($utmcontent);
         

        },
        dataType: "xml",
        statusCode: {
          0: function (data) { 
            console.log(data);
            console.log('CROS Error');
            download();
            location.href = "./thankyou.php";
            return true;
          },
          200: function (data) { 
            download()
            location.href = "./thankyou.php";
          },
          403: function (data) { 
            console.log('403 Error');
          }
        },
        error: function (xhr, status, error) {
          console.log('There was an error in CRM Entry');
        }
      })
      return false;
    }
    
  </script>