What am i trying to do
I am programming a currency converter, and I do not need to manually update the current currency, I get the current value from another site through AJAX and Whatever Origin (to allow access to another domain). I tested it on a separate page and it worked perfectly, i.e. Showed current currency. However, when I pasted it into the actual converter code ...
Error
... any console blames the illegal character inside the jQuery file, even if I reference the Google library:
SyntaxError: illegal character jquery.min.js:1:4 ReferenceError: $ is not defined Converter.html:75:0
Wherever I am (at the beginning, in the middle or at the end), the same error occurs, but only if I paste my code there, if I only link the jQuery file, no errors are visible.
Code
$.getJSON('http://whateverorigin.org/get?url=' + encodeURIComponent('http://usd.fx-exchange.com/brl/') + '&callback=?', function (data) { currency = $('.today_s', data.contents).html(); currency = currency.match(/\d\.\d\d\d\d/); });
The page I'm trying to go to is here .
Working test page: here .
I don’t even know what is going on.
source share