0

I'm trying to load html using jqyery. That HTML includes a js file, and every time I try to load it it doesn't execute js file included in it. But when I write the script inside the html page it works fine.

What doesn't work:

<link rel="stylesheet/less" href="/categories/categories.less">
<div id="categories">

</div>
<script type="module" src="/categories/categories.js"></script>

What does work:

<link rel="stylesheet/less" href="/categories/categories.less">
<div id="categories">

</div>
<script >
  console.log('categories has been loaded');
</script>
Ahmad Sami
  • 137
  • 3
  • 10
  • Please visit the [help], take the [tour] to see what and [ask]. ***[Do some research](https://www.google.com/search?q=jquery+load+html+with+script+site:stackoverflow.com)***, search for related topics on SO; if you get stuck, post a [mcve] of your attempt, noting input and expected output using the `[<>]` snippet editor. – mplungjan Nov 11 '20 at 06:59
  • @mplungjan trust me I went across all of them, and NOT a single one of them worked. and actually they are a little bit different than mine – Ahmad Sami Nov 11 '20 at 07:32
  • [Try this one](https://stackoverflow.com/a/47301863/295783) – mplungjan Nov 11 '20 at 07:46

0 Answers0