jQuery Ajax, please give me a CSV

Question is — is it possible to sredstvami jQuery CSV from a different domain/site, in my case Yahoo Finance

PS JSONP — requests data, but when parsing the data produces an error, obviously due to the fact that does not receive JSON.
$.ajax({
 url: 'http://finance.yahoo.com/d/quotes.csv?s=AAPL&f=bcll2l3nosx',
 success: function (resp) {
console.log(resp);
},
 error: function(e){
console.log('Error!');
},
 dataType: 'jsonp'
});

In the console of chrome I see: Uncaught SyntaxError: Unexpected token ,
October 8th 19 at 02:16
3 answers
October 8th 19 at 02:18
Solution
1. You cannot use frames, then you cannot pick up the text if they are from another domain
2. You cannot use JSONP it requires a valid JS response, and there are none
3. You cannot use normal Ajax, the browser will not make a request.
You can make a service that will pick up csv from Yahoo, translate it into JSON and give it using JSONP. This is the only option, or find a service which is already working with JSONP
Thank you! - Jamison commented on October 8th 19 at 02:21
October 8th 19 at 02:20
In a nutshell how JSONP works:
1. A request is created, and connects the script with the address You're calling.
2. The receiving party generates a response of the form yourCallbackFunction()
2.a colback jQuery itself does everything himself.
2.b note
3.!!!
4. PROFIT

Conclusion:
1. To use JSONP the server side should know what You want and should be ready for it
2. The server side needs to give a valid code
3. Uncaught SyntaxError: Unexpected token — this means that the JS interpreter is not ready to be a comma in this place, and it is there, because: 544.57,"+3.18 — +0.59%",... Not valid JS code
ru.wikipedia.org/wiki/JSON#JSONP_.26_JSONPP - Jamison commented on October 8th 19 at 02:23
October 8th 19 at 02:22
Try to pick up the csv in plain text, and then use some thread plugin. For example, code.google.com/p/js-tables/wiki/CSV or any other.
You can't take plain text from a different domain. - Jamison commented on October 8th 19 at 02:25
I'm sorry, you tried it, and about origin policy forgot. Then, through hidden iframe — $('body').append(") and then read text from the document. In General, if there is jsonp, it is easier and more correct to use it. - aniya.Kertzmann65 commented on October 8th 19 at 02:28
$('body').append('<iframe src="http://habrahabr.ru"></iframe>');
- Erik_Muller76 commented on October 8th 19 at 02:31

Find more questions by tags Domain names marketJSONYahoojQueryFintech