What I'm trying to do
I'm programming a currency converter, and to not have to manually update the current currency, I get the current value from another website trough AJAX and Whatever Origin (to allow access to another domain). I tested it in a separated page and it worked perfectly, i.e. showed the current currency. However, when I inserted it in the actual code of the converter ...
The error
... any console accuses illegal character inside the jQuery file, even if I link to Google's library:
SyntaxError: illegal character jquery.min.js:1:4
ReferenceError: $ is not defined Converter.html:75:0
Wherever I put it (in the beginning, middle or end), the same error happens, but only if I insert my code there, if I only link the jQuery file, no errors are showed.
The 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 move to: here.
The working test page: here.
I don't even have a clue of what is happening..