Mon Dec 05 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
function submitEmailToECvj(email, lang) {
   
    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' : 
          'http://www') 
          + '.rosettastone.com/?redirect2mobile=no&p_p_id=rosettaajaxsubmit_WAR_rosettaajaxsubmitportlet&p_p_lifecycle=2&data=';
   
    var data = {
        email : email,
        demo_lang : map[lang] || lang,
        cis_name : 'golden_ticket',
        website: 'US_WEBSITE',
        form_type : 'demo',
        demo_type : 'PE',
        form_url : 'hub-rs',
        cid: grabUrlParam('cid') || '',
        newsletter_type : "DTC_mobile-demo"
    }

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

    request.done(function(msg) {
        if (/"cisFlag":"true"/.test(msg)) {
          console.log(msg)
        }else{
          $('input[type=text]').addClass('input-error').attr('placeholder', 'Sorry, try again!')
        }

    })
}

submitEmailToECvj('vjohn@rosettastone.com','esp' )