I'm trying to initiate a DataTables instance with the following code...
<script type="text/javascript" language="javascript" class="init">
$(document).ready(function() {
$('#example').DataTable();
} );
</script>
But when I access the HTML via web the browser shows an "Uncaught SyntaxError: Unexpected number" error and this is how the source looks from the browser...
<script type="text/javascript" language="javascript" class="init">
0 11 4 3 2 1 0document).ready(function() {
0 11 4 3 2 1 0'#example').DataTable();
} );
</script>
As you can see some instructions have been replaced by the numbers "0 11 4 3 2 1" and I don't know what is causing it.
jQuery is src from Google and the DataTables javascript from their CDN.
I'm creating the HTML from a Perl script using CGI, printing the Content-type:text/html header and used different !DOCTYPEs... but still nothing. Editing the code shows no hidden chars.
Your help will be much appreciated.
Best, e.
EDIT: This is the Perl code creating the HTML...
use Switch;
use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';
print "Content-type:text/html\r\n\r\n";
print qq{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<link rel="stylesheet" type="text/css" href="css/jquery.dataTables.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script language="JavaScript" type="text/javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
$(document).ready(function() {
$('#example').DataTable();
} );
/* ]]> */
</script>
</head>};