3

I am using DataTables for a project and want to include this CDN provided (picture below). enter image description here

How do I add this to my HTML file? Do I have to add this CDN link between somewhere in my HTML file? It does not seem to be working correctly.

Thanks

H Memon
  • 61
  • 1
  • 2
  • 7
  • 1
    Does this answer your question? [How do I link a JavaScript file to a HTML file?](https://stackoverflow.com/questions/13739568/how-do-i-link-a-javascript-file-to-a-html-file) – SuperStormer May 02 '20 at 00:06
  • **DO NOT post images of code, data, error messages, etc.** - copy or type the text into the question. [ask] – Rob May 02 '20 at 00:09
  • 1
    Side note: In the above CDN example, the URL starts with `//cdn.datatables.net...`. But this protocol-relative URL should [no longer be used](https://www.paulirish.com/2010/the-protocol-relative-url/). The URL examples in the answers to this question (which start with `https:`) are more appropriate. – andrewJames May 02 '20 at 01:46

3 Answers3

5

You can add cdn like this:

<script src="https://cdn.datatables.net/plug-ins/1.10.20/sorting/enum.js"></script>

or you can create a custom js file in which you can paste all code of this file and then save it in whatever the folder you want and then link it for example:-

<script src="js/enum.js"></script>
Aslam khan
  • 315
  • 1
  • 7
1

A CDN is a content delivery network: https://www.cloudflare.com/learning/cdn/what-is-a-cdn/ you can add it in the end of the body tag

<script src="the cdn"></script>
S.alhaider
  • 124
  • 2
  • 11
0

Make sure you add it at the very top of your HTML code in this format

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

src= points to the CDN file ...there are different CDN directories and some are more stable than others so be careful where it's hosted