How to resolve language file URL for Jquery datata

2019-09-14 02:35发布

In my ASP.NET app I am using Jquery datatables plugin like this:

    <script type="text/javascript">
      $('#grdData').DataTable({
          "language": { "url": "Scripts/json/table-language.json" }
      });
   </script>

when running this on localhost it works fine and it fetches the json file. But in production I get a 404 not found error. I guess it somehow relates to relative path... any ideas on how to fix the path so it would work?

1条回答
孤傲高冷的网名
2楼-- · 2019-09-14 03:16

I found the problem. It was related to IIS, I needed to add Mime Type of .json extension and it did the trick.

查看更多
登录 后发表回答