I greet everyone, this is not a hard day

I wanted to parse JSON from a specific file on a hosting, into a variable, I started with output to the console. I try to display the page data in the console.

//1. с чего я начал var urlparse = 'http://mysite.ru/file.txt'; $.ajax({ url: urlparse, dataType: 'jsonp', async: false, success: function(data) { console.log(data); } }); 

error in console, need callback .. error - my URL +? callback = jQuery191050 ...

 //2. пробуем, но уже с коллбэком function meCallback(urlparse, callback) { $.ajax({ url: urlparse, dataType: 'jsonp', async: false, success: function(data) { callback(data); } }); } var urlparse = 'http://mysite.ru/file.txt'; meCallback(urlparse, function(data) { console.log(data); }); 

crashed: Uncaught SyntaxError: Unexpected token .. he tried to change the dataType, but then other errors pour

Gentlemen, explain how to correctly read the file data from the hosting?

ps there on the page, something like: {"1111": {"letters": "1111"}, "1112": {"letters": "1112"}}


upd: the error is this with jsonp, in the console the red line:

 Uncaught SyntaxError: Unexpected token : file.txt?callback=jQuery1910290…_1479647887056&_=1479647887057:1 
  • Add the full text of the errors to the question - Grundy
  • added. eats but if from the browser to go to this page (text file), everything is displayed - serg

0