1

I send ajax to url , but i get error. Here is my code:

$.ajax({
    url: "http://webrates.truefx.com/rates/connect.html?q=ozrates&c=EUR/USD&f=csv&s=n",
    dataType : 'jsonp',
    success: function (data) {
        alert(data);
    }
})

Maybe i doing something wrong?

Filburt
  • 17,626
  • 12
  • 64
  • 115

1 Answers1

0

In order to access data using JSONP, the server you are requesting the data from must format its response as JSONP.

You are getting an error because the response is not JSONP (it is CSV, which you asked for explicitly when you put t=csv in the query string).

Either:

  • Use a different method to get the data
  • Change the server so it responds with JSONP formatted data
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335