I have a wordpress site and want to display the subscription rate for our software for the year. Im using money.js and accounting.js to convert the rate and display the currency correct and an API to pull the exchange rates.
here is my script
jQuery(document).ready(function() {
fx.base = "EUR";
fx.settings = {
from: "EUR"
};
var amount = 432.00;
jQuery.getJSON(
'http://ift.tt/1UmIXTI',
function(data) {
// Check money.js has finished loading:
if (typeof fx !== "undefined" && fx.rates) {
fx.rates = data.rates;
fx.base = data.base;
} else {
// If not, apply to fxSetup global:
var fxSetup = {
rates: data.rates,
base: data.base
}
}
// now that we have exchange rates, add a few to our page
var USD = fx.convert(amount, {
to: "USD"
});
var GBP = fx.convert(amount, {
to: "GBP"
});
var JPY = fx.convert(amount, {
to: "JPY"
});
var EUR = fx.convert(amount, {
to: "EUR"
});
var AUD = fx.convert(amount, {
to: "AUD"
});
var ZAR = fx.convert(amount, {
to: "ZAR"
});
USD = accounting.formatMoney(USD, "$ ", 0);
GBP = accounting.formatMoney(GBP, "£ ", 0);
JPY = accounting.formatMoney(JPY, "¥ ", 0);
EUR = accounting.formatMoney(EUR, "€ ", 0);
AUD = accounting.formatMoney(AUD, "$ ", 0);
ZAR = accounting.formatMoney(AUD, "R ", 0);
jQuery("#UsdPrice").html(USD);
jQuery("#ZarPrice").html(ZAR);
jQuery("#AudPrice").html(AUD);
}
);
});
I want to display the converted price for South Africa, USA, Australia. Everything else is working, but cant figure out how to get the users location. I have tried this plugin http://ift.tt/1qsjokf but it seems theres problems with the database the plugin uses. Any help welcome
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire