I'm trying to load some .csv file from remote servers (so I have to deal with domain problem), and I'm using jsonp with the following code
sql="a csv file link"
$.ajax({
url:sql,
dataType:'jsonp',
}).done(function(){
console.log("done");
}).error(function(){
console.log("err");
}).fail(function(){
console.log("fail");
}).success(function(){
console.log("success");
});
Some how, this piece of code gives me 2 different result.
1) On certain csv file links, it seems to be getting the complete csv file. However, there is an error saying that the csv file has a "syntax error", and .error and .fail is executed.
2) On some other csv file links (something like.http:// host.com:port/file.csv? select from table), somehow nothing happens. The .done/.success are not called, nor the .fail/.error are called
Can anyone tell me the solution or possible causes of those above problems?
Thanks!