Beginner question: Datatables example only works if I put jquery script in both the header and body?
Beginner question: Datatables example only works if I put jquery script in both the header and body?
I'm fairly green with this type of development, but I'm trying to implement datatables in a site I'm building. To start I tried building the Zero configuration example on my local environment.
Following the forum guidelines I've setup what I've done on the sites test case page. With the jquery script, if I place it within the <head> section, the data shows on the page but it loses all formatting. If I place it at the bottom of the <body>, the screen is blank. It only works as properly if I put the script in both locations.
Could someone tell me what I'm doing wrong here and how to correct it?
This question has an accepted answers - jump to answer
Answers
This line has a syntax error:
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"</script>
You are missing the closing
>
afterdataTables.min.js"
. Should look like this:<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
Then you can have the Datatables init code in either spot but I think its generally recommended place the code at the end of the page.
Kevin
Thanks, I figured it was something simple! Just had a weird result from the missing bracket.