Reputation: 75
i using javascript file (json2.js) in perl-cgi code with apache. but when i run it on browser, its unable to find the source and return following error; 'Failed to load resource: the server responded with a status of 404 (Not Found)'
my doumentroot path is : /srv/www/cgi-bin and scripts' path: /srv/www/cgi-bin/scripts
i doing this;
print "<script type='text/javascript' src='./scripts/json2.js'></script>"; # Line 1
print "<script type='text/javascript' language='JavaScript'>
function setDetails(o,json_arrRef,arrSize){
alert('hello='+arrSize+' || ref='+json_arrRef); // till here it works fine
var json_obj = JSON.parse(json_arrRef);
}
</script>";
if I edit Line 1 as
print "<script type='javascript' src='./scripts/json2.js'></script>";
it finds the source but gives following error when 'JSON.parse()' is called; 'Uncaught SyntaxError: Unexpected token ILLEGAL'
am I doing something wrong?
Upvotes: 0
Views: 372
Reputation: 944441
Upvotes: 2