Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught fx error #8

Open
mwzip opened this issue Oct 21, 2012 · 15 comments
Open

Uncaught fx error #8

mwzip opened this issue Oct 21, 2012 · 15 comments

Comments

@mwzip
Copy link

mwzip commented Oct 21, 2012

Hello,

money.js seems like a great library, but I can't seem to get it working. No matter what, I always get: "Uncaught fx error" as the javascript console output and the conversions don't seem to be working.

I get this error on a fresh page with just money.js included and the BASIC convert() function being called. To be more specific, the error also says: "b.convert (anonymous function)"

Any ideas?

@evert0n
Copy link

evert0n commented Nov 15, 2012

If you are loading the rates like in the jquery ajax examples make sure you call fx only after that.

Another point is about where are you calling fx, you can try to call it using window.fx and check if works.

@ezkl
Copy link

ezkl commented Nov 15, 2012

call it using window.fx

👍 Works for me.

@Iknuts
Copy link

Iknuts commented Mar 10, 2014

Im having the same problem... my page wont load even after I call the window.fx

I feel I must be missing something. Please help!!

@baidru
Copy link

baidru commented Aug 25, 2014

Hi,

I am having the same problem... "Uncaught fx error please guide me how to solved this error
IF possible tell me where to write code to fix this.

My Website URL :- http://vandvshop.com/production/

I am in trouble pls help me

Thanks!

@JerJohn15
Copy link

Was this issue ever resolved? I'm having the same problem.

@FWSimon
Copy link

FWSimon commented Dec 20, 2015

same problem here

@nsantiago2719
Copy link

Try using other currencies. Like fx.convert(1000, {from: "GBP", to: "HKD"}); if it works then the problem is in your JSON response. It can't find the currency you are trying to convert. I just noticed this on my current project.

@JerJohn15
Copy link

I ended up resolving my issue, by looking at the money js source code. The line in question was:

// Throw an error if either rate isn't in the rates array
        if ( !rates[to] || !rates[from] ) throw "fx error";

There was no "from" value set in fx.settings, so setting it to my base currency seemed to fix that issue:

fx.settings = { from: "USD"};

. I also had to set the fx.convert function within the function where I make my JSON request and use bind(this) to bind the data.

@agucova
Copy link

agucova commented Apr 18, 2016

I don't understand what's happening, but it's not working

@mshibl
Copy link

mshibl commented Mar 15, 2017

Same issue

2 similar comments
@maelswarm
Copy link

Same issue

@dnlmzw
Copy link

dnlmzw commented Jan 30, 2018

Same issue

@karthiknvlr
Copy link

same issue

@blackwatertepes
Copy link

+1

@iAminaDarwish
Copy link

You'll need to wait until the AJAX request has completed before you can begin processing conversions.
If you can't do that, then set default rates ( not the latest / local array of rates), then when you get your ajax request response replace that array with the latest rates.
MoneyConverter.base = "USD"; MoneyConverter.rates=[ "AED": 3.673123, "AFN": 69.469, "ALL": 105.04, "AMD": 478.652004, "ARS": 20.1765] axios .get("api/currencies/rates";) .then(function(response) { MoneyConverter.rates = response.data.data; })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests