Resetting all scripts in a PJAX page

If I have different pages that I retrieve using PJAX, the scripts I use, the first page I access is stored in the second, and any page that is accessible after that through PJAX.

I tried resetting functions and things like this that work way too much. Is it possible that when the PJAX page changes, I can reset all Javascript bindings?

Is it possible to partially render on a Javascript page? (for example, saving jQuery to change the page, but removing other scripts on the page)

Since a Javascript file can only be referenced by adding a tag <script>

, is it possible to do the opposite? (I know removing that script tag does not remove the script)

+3


source to share


1 answer


Your internal "frames" must not contain Javascript. You have to place all your Javascript in functions available at the very top level of your page, and then you can hook into page changes using the PJAX API to enable / disable functionality.



+1


source







All Articles