此命令在较早版本的WampServer 3.1.6中运行,但在最新版本3.1.7中未运行。请分享有关如何解决此问题或如何加载脚本csv.js
的解决方案。我已经尝试了许多版本,但没有一个起作用。
Bulkdatainsertion.php
<?php
include 'sidebar.php';
include 'server.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>Bulk Data Insertion</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-csv/0.71/jquery.csv-0.71.min.js"></script>
<!-- This is the query that is not loading: -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-csv/0.8.3/jquery.csv.min.js"></script><script src="https://web.archive.org/web/20160324220311/http://jquery-csv.googlecode.com/git/src/jquery.csv.js"></script>
</head>
<script>
var data;
$(document).on('click', '.edit', function() {
var file = $('input[type=file]').val();
var filename = $('input[type=file]').val().split('\\').pop();
console.log(filename+'hh');
// From here the code is running. We get the filename csv.hh in the console.
$.ajax({
type: "GET",
url: filename,
dataType: "text",
success: function(response)
{
data = $.csv.toArrays(response);
console.log(response);
some(data);
}
});
});
function some(data) {
console.log(data);
$.ajax({
url:"server.php",
method:"POST",
dataType:"json",
data:{data:data},
success:function(data){
console.log(data);
var i=0;
for (i = 0; i < data.length; i++) {
$('#sno').append('<input type="checkbox" name="s_no[]" value="'+data[i]+'" id="serialnumber"> ');
$('#sno').append('<label>'+data[i][7]+'</label><br>');
}
}
});
// $('#import_form').submit();
$('#update').click(function() {
console.log('hello');
$('#import_form').submit(function(event) {
event.preventDefault();
});
});
$('#skip').click(function() {
console.log("hello");
$('#import_form').submit();
});
if ($('#skip').data('clicked')) {
console.log('hello');
$( "#import_form" ).submit(function(event) {
event.preventDefault();
});
}
}
$(document).on('click', '.del', function() {
var del = $(this).attr('id');
var row = $(this).closest('tr');
if (confirm('Are you sure?')) {
$.post('server.php?file_id='+del, function(r) {
alert(r);
});
}
row.remove();
});
</script>