简体   繁体   English

无法在LAMP服务器上使用Javascript

[英]Trouble getting Javascript working on LAMP server

I am running a LAMP server on void linux with an html frontend from my database. 我在空linux上使用来自数据库的html前端运行LAMP服务器。 For some of the features I want I need to use javascript. 对于某些功能,我需要使用javascript。 I'm fairly new to javascript and have never had to mess with it serverside. 我对javascript相当陌生,从没在服务器端弄过它。

I have attempted to install jQuery and jspdf, I dropped them in the folder I was using for the site /srv/www/apache/incidents and linked them in my html. 我尝试安装jQuery和jspdf,我将它们放到用于/srv/www/apache/incidents网站的文件夹中,并将它们链接到我的html中。 When jspdf wasn't working I decided to make a test html page which looks like this: 当jspdf无法使用时,我决定制作一个如下所示的测试html页面:

<!DOCTYPE html>
<html>
<head>
<script src="/incidents/jquery-3.4.1.min.js"></script>
</head>
<body>
<p id="demo"></p>
<script>document.getElementByID("demo").innerHTML = "Hello";</script>
</body>
</html>

It should write "Hello" at the top of the page, but it stays blank. 它应该在页面顶部写“ Hello”,但它保持空白。 Is there something I am doing wrong here or have I missed something in the apache configuration? 我在这里做错什么了吗,还是在apache配置中错过了什么? I searched all the files in /etc/apache/ and searched the repos for anything js/apache related. 我搜索了/etc/apache/所有文件,并在存储库中搜索了与js / apache相关的任何内容。 Nothing shows up in /var/log/httpd/error_log . /var/log/httpd/error_log什么都没有显示。 I know void is a little different, but up until now its been smooth sailing. 我知道虚空有些不同,但是直到现在它一直很平稳。

your javascript block is wrong 您的JavaScript区块有误

<script>document.getElementByID("demo".innerHTML = "Hello";</script>

there is a missing ) , try like this: 缺少 ,请尝试如下操作:

<script>document.getElementById("demo").innerHTML = "Hello";</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM