Thu May 11 2017
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
/*
 * Script to update prices in rs.com/pricing
 */


// FETCH RSI
var req = $.ajax({
  url: 'http://www.rosettastone.com/lp/globals/models/sitewide.js',
  dataType: 'script'
})


req.done(function(data){
  var prices = {
    's24': RSI({cat:'esp', lvl:'24'})[0].price,
    's12': RSI({cat:'esp', lvl:'12'})[0].price,
    's6': RSI({cat:'esp', lvl:'06'})[0].price,
    's3': RSI({cat:'esp', lvl:'03'})[0].price,
    'd5': RSI({cat:'esp', lvl:'S5'})[0].price,
    'd3': RSI({cat:'esp', lvl:'S3'})[0].price,
    'd2': RSI({cat:'esp', lvl:'S2'})[0].price,
  }

  Object.keys(prices).forEach(function(e, i) {
    var price = '$' + prices[e]
  
    // UPDATE DOM
    $('#' + e).find('.price').html(price)
  })

})