seyyed
(Arash)
1
I have a site.js script file and added it to AppAsset.
I put my view in a Pjax block. a DataGrid and a Form are in view.
in view:
<div id="testJS" class="well">
click for test
</div>
in site.js:
$("#testJS").click(function(){
alert("test OK");
})
it’s work fine before any pjax action.
after any pjax request (for example go to page2 of datagrid) it’s not working.
alex-w
(Pr0j3ct A1ex)
2
The event will be lost when the html is reloaded.
You’ll need to attach the event to something that doesn’t change with ajax.
$('#container').on('click', '#testJS', function() {});
seyyed
(Arash)
3
first there is no reload on html but replace.
second the event of $(’#testJS’).click occurred after pjax:success event