我在我的web api应用程序中有这个:
在CaisseAssurance
脚本中,我使用了datatable plugin
var table = $('#tbl').dataTable({
"processing": true,
"bPaginate": true,
"bLengthChange": false,
"bFilter": true,
"bSort": false,
"bInfo": true,
"responsive": true,
"scrollX": true,
"scrollY": "200px",
"scrollCollapse": true,
"bAutoWidth": false,
//"language": { "url": "datatable.french.json" },
"language": { "url": "../datatable.french.json" },
"lengthMenu": [[50, 100, 250, 500, -1], [50, 250, 500, "Tout"]],
"destroy": true,
"aoColumnDefs": [
{ "width": "0.1%", "targets": 0 }
]
});
我的问题是找不到json文件(在这两种情况下)
//"language": { "url": "datatable.french.json" },
"language": { "url": "../datatable.french.json" },
获取http://localhost:6460/datatable.french.json 404(未找到)
所以我需要知道:
答案 0 :(得分:0)
我通过在 web.config 文件
中添加此代码段来解决此问题<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>