var currencies = new Array(); currencies.push('£'); currencies.push('€'); currencies.push('$'); /** * AJAX request to update currencies section */ function change_currency(product_id) { $.post('ajax/currency_loader.php', {'currency_selector' : $("#currency_selector").val(), 'product_id' : product_id}, reload_rates, "text"); } /** * actions to render HTML after successful rate load */ function reload_rates(data) { //alert(data); var data = eval('(' + data + ')'); if ( (data.conversion_rate > 0) && (currencies[data.sort_order]) ) { $(".currency").text(currencies[data.sort_order]); $(".currency_value").each(function(el) { $(this).text(Math.round($("#"+this.id+'_input').val() * data.conversion_rate)); }); } }