1

Im using the following code to load a Html file from a url with the help of the bootstrap modal function, wich loads the content with ajax after click on the button. Unfortunately it works just the first time, the second time the html part of the file loads fine but not the script inside the html file (see code). Any idea how to fix this problem? thx

    <div class="small">
    <a href="/faxx.html" data-remote="false" data-toggle="modal" data-target="#myModal" class="btn btn-default">button</a>
    </div>  

    <div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <!-- Load Ajax Content here -->
                </div>
            </div>
        </div>        
    </div>

faxx.html:

    <div class="content">
        <a href="https://twitter.com/tttt" class="twitter-follow-button" data-show-count="true">@tttt</a></span>
        <!-- and so on -->
    </div>

    <div id="fb-root"></div>

    <script>(function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=194384";
        fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
    </script>

    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
    <script src="https://apis.google.com/js/platform.js">
        {lang: 'de'}
    </script>
  • This is a similar problem to http://stackoverflow.com/questions/12286332/twitter-bootstrap-remote-modal-shows-same-content-everytime in that you are running functions on the load of the Faxx.html and then these don't get re-run when you toggle the modal open and shut. – Leo Farmer Feb 27 '17 at 02:22
  • Thank you - i will give it a try. – Learning by doing Feb 28 '17 at 09:29

0 Answers0