servercode.js
var express = require('express');
var app = express();
app.get("/abc",function(req, res) {
res.send("Hello");
});
clientcode.html
<html>
<head>
<script type="text/javascript">
$.get("/abc", function(string) {
alert(string);
})
</script>
</head>
<body>
There is no as such body of this. Its just works. :)
</body>
</html>
我想从我的客户端调用servercode.js脚本。这两个文件都在节点服务器上。这样我就可以在客户端收到警报Hello。 虽然我的主要目的是定期调用一个函数,该函数将写在servercode.js文件中。但暂时我甚至无法从服务器接收hello响应,我的文件在firebase托管中。 我希望我对自己的问题很清楚。 帮助我!!非常感谢你。