There was a need for parsing a csv file located on another site. I threw in ajax , but now the browser swears at CORS - they say the file should be located only on your server. There are ways to circumvent this problem without using third-party plug-ins like PaPa Parse ? Here is the actual code:

 $.ajax({ type: 'GET', url:"http://frontend.usdev.ru/tarif.csv", success:function(data) { var employee_data = data.split(/\r?\n|\r/); var table_data = '<table class="table table-bordered table-striped">'; for(var count = 0; count<employee_data.length; count++) { var cell_data = employee_data[count].split(","); table_data += '<tr>'; for(var cell_count=0; cell_count<cell_data.length; cell_count++) { if(count === 0) { table_data += '<th>'+cell_data[cell_count]+'</th>'; } else { table_data += '<td>'+cell_data[cell_count]+'</td>'; } } table_data += '</tr>'; } table_data += '</table>'; $('#employee_table').html(table_data); } }); 
  • There is a workaround - use your own server for proxying requests. - Stepan Kasyanenko

0