Why can't an entire html file be displayed?

client code

<html>
<head>
    <title></title>
    <script src="http://127.0.0.1/jquery-3.3.1.js"></scritp>
    <script type="text/javascript">
    var localHandler = function(data){
        alert("remote.jsjs:" + data.result);
    };
    </script>
    <script type="text/javascript" src="http://remoteserver.com/remote.js"></script>
</head>
<body>
</body>
</html>
The

server
remote.js file code is as follows:

localHandler ({"result": "I am the data from remote js"});

Open the client-side web page and get the server-side data.

next, I make a modification to get the contents of any html file on the server side.

client code

<html>
<head>
    <title></title>
    <script src="http://127.0.0.1/jquery-3.3.1.js"></scritp>
    <script type="text/javascript">
    var localHandler = function(data){
        alert(data);
    };
    </script>
    <script type="text/javascript" src="http://remoteserver.com/remote.js"></script>
</head>
<body>
</body>
</html>
The

server
remote.html file code is as follows:

it is a test

Why did you report an error:

Uncaught SyntaxError: Unexpected token <

src= "http://remoteserver.com/remote.js" must be a js file? Cannot use html to impersonate js?

May.22,2021
The

script tag is used to load js code. If you want to get the server-side html, you need to use Ajax or fetch to get it in js.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35631-2bf74.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35631-2bf74.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?