pjax
pjax copied to clipboard
different script for different pages?
Hi.
I wan to have different <script src>
tags in different pages.
All of my pages have same DOM (except script tags) and my new HTML content is replaced successfully inside of specified div.
But I don't know why these
Therefore I added scrip
and script#id
to the selectors
section to load new script tags, but it results in full page loading.
I know this approach is not correct.
So, How can I have different <script>
sections for different pages?
I have same problem
I solved this in the past by comparing the fetched DOM scripts to the current ones, then loading the new ones (the ones not present in the current page) dynamically (either with native import or with a third-party library such as systemjs or requirejs...). While this worked very well for script files, I couldn't find an equally clean solution for inline scripts, for which I ended up using eval...