Test

Rangliste

Klicken Sie auf Daten laden </ title> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"> </ script> <link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> <script src = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"> </ script> </ head> <body> <div class = "container"> <div class = "table-responsive"> <h1 align = "center"> Bitte klicken Sie auf Daten laden </ h1> <br /> <div align = "center"> <button type = "button" name = "load_data" id = "load_data" class = "btn btn-info"> Daten laden </ button> </ div> <br /> <div id = "employee_table"> </ div> </ div> </ div> </ body> </ html> <script> $ (document) .ready (function () { $ ('# load_data'). click (function () { $ .ajax ({ URL: "sample.csv", dataType: "text", Erfolg: Funktion (Daten) { var employee_data = data.split (/ \ r? \ n | \ r /); var table_data = '<table class = "tabelle tabellenbegrenzt tabellengestreift">'; 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>'; } sonst { table_data + = '<td>' + cell_data [cell_count] + '</ td>'; } } table_data + = '</ tr>'; } table_data + = '</ table>'; $ ('# employee_table'). html (table_data); } }); }); }); </ script></div> <div class="paragraph"> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title>CSV to HTML Table

00000192