Ive added the money.js to a Lightswitch application and have put this code on the execute of a button but I just get returned the value 100, can anyone see what im doing wrong here or some code I am missing,
myapp.AddEquipmentToOrder.test_execute = function (screen) {
var price = 100;
fx.settings = {
from: "USD",
to: "GBP"
};
fx.convert(price);
window.alert("test value: " + price); //currently returning 100
};
ive followed this guide: http://www.paulund.co.uk/how-to-create-an-exchange-rate-money-converter-with-money-js?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Paulundcouk+(PaulUnd)
which is very useful and easy enough to understand but I just cant see where ivr gone wrong. the only part im not sure is the code below this comment "Here is a PHP way to populate the rates." as I have no experience in PHP. I tried copying this to the page I added the above code on but it all becomes underlines as its the wrong language.
thanks for any tips or suggestions.
and an answer in C# would be even more helpful than javascript as im a lot more experienced in that.
This works for me and is far similar than using the money.js
if (screen.TABLENAME.Currency == "CAD ($)") {
$.ajax({
url: ("http://devel.farebookings.com/api/curconversor/CAD/GBP/" + screen.TABLENAME.Price + "/"),
dataType: 'jsonp',
success: function(data) {
screen.TABLENAME.Price= data.GBP;
screen.TABLENAME.ExtendedPrice = ((data.GBP * screen.TABLENAME.Quantity) -
(data.GBP * screen.TABLENAME.Discount) * screen.TABLENAME.Quantity);
screen.TABLENAME.ItemOnOrder = true;
myapp.commitChanges();
}
});
}