Tue Jul 26 2016
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
function submitEmailToEC(email, langCode, cis_name) {
      var defer = jQuery.Deferred()

      $(document).trigger('demo_email', {
        email: email,
        is_offer: false
      });

      var baseURL = (window.location.href.search(/(\.stg\.)|(local)/i)>-1 ?
            'http://www.stg' : 
            'https://www') 
            + '.rosettastone.com/?p_p_id=rosettaajaxsubmit_WAR_rosettaajaxsubmitportlet&p_p_lifecycle=2&data=';
 
      var data = {
          email : email,
          demo_lang : langCode,
          cis_name : cis_name,
          website: 'US_WEBSITE',
          form_type : 'demo',
          demo_type : window.demo_type || 'Demo_Desktop',
          form_url : 'homepage',
          newsletter_type : window.newsletter_type || "Mid_Catalog_LearnPage",
          cid: _satellite.getVar('mostrecentcampaign')
      }

      var request = jQuery.ajax({
          contentType: "application/json; charset=utf-8",
          url: baseURL + encodeURIComponent(JSON.stringify(data)),
          type: "POST",
          dataType: "jsonp",
          data:data
      });

      request.done(function(msg) {
          if (msg[0].cisFlag == true) {
              // Doty's demo pixel
              $('body').append('<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/1041440066/?label=WzGCCNzOy1gQwrrM8AM&amp;guid=ON&amp;script=0"/>')
              // record the email in a cookie that expires in 30 days
              RSUI.util.setCookie("curEmailIdsc",email)
              //document.cookie = 'curEmailIdsc='+email+'; max-age='+60*60*24*30+'; path=/;';
              defer.resolve('success')
          }

      })
      return defer.promise()
  }