I'm using hinclude to load content asynchronously as briefly explained in http://symfony.com/doc/current/book/templating.html#asynchronous-content-with-hinclude-js. The fragment has successfully been loaded asynchronously however, I'm not able to run java-scripts from within in the fragment. I was wondering if there was a callback function right after the fragment has been loaded or any other way to run script from within the fragment. I've the code below to render the fragment using hinclude:
{% render "DBundle:Prt:viewSns" with {'slug': prt.id}, {'standalone' : 'js'} %}
I've looked a bit in the hinclude.js code. It is inserting the loaded content via element.innerHTML. That means that your javascript will never be evaluated.
There's a pull request that does what you want here: https://github.com/mnot/hinclude/pull/8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With