vendredi 20 novembre 2020

jQuery load a whole html table with script tag

I would like to load a whole table from table.html that contains javascript, but unfortunately it does not load into the index.html file.

index.html

<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="js.js"></script>
    <script>$( "#load" ).load( "load.html" );</script>
</head>
<body>
<div id="load"></div>
</body>
</html>

js.js

function make(number) {
    document.write('<td align="center"valign="bottom" nowrap>'+number+'</td>');
}

load.html

<script src="js.js"></script>

<table border="1">
    <div>
        <tr>
            <script>
            make(1342);
            </script>
        </tr>
    </div>
    <div>
        <tr>
            <script>
            make(133);
            </script>
        </tr>
    </div>
</table>

Aucun commentaire:

Enregistrer un commentaire