.load() page <script> problem... [hard to summaries a title for this issue...]
Hi, sorry... I don't know how to describe this problem or give a good title...
but, try this out on any of your page...
-
$( '#btn' ).click(function(){
$( '#container' ).load('testing.html');
});
and put this inside testing.html
- <script type='text/javascript'>
- $( document ).ready(function(){
- $( '#testing' ).text('executed');
- });
- </script>
- <div id='testing'>no script</div>
try to click the button#btn 3 times...
you will find the loaded testing.html will only run the script 2 times..
then it will show no script for the rest....
I tried it on chrome, firefox.
anyone know to solve this problem or who was trying to make a full ajax site may have alternative way to load and remove??