ruby on rails - Javascript within pop-up modal not running -
how bellow code run within load of javascript pop-up modal box? i'm using facebox. http://defunkt.io/facebox/
<% content_for :javascript %> <script type='text/javascript'> $(function () { function initializeevents() { /* new category */ $('#new_admin_category').on('ajax:success', function (event, data, status, xhr) { $("#dashboard_categories").html(data.html); initializeevents(); }); /* delete category */ $('a[data-remote]').on('ajax:success', function (event, data, status, xhr) { $("#dashboard_categories").html(data.html); initializeevents(); }); } initializeevents(); })(); </script> <% end %>
if need more context code doing, please see previous question here: rerun javascript on successful ajax call
solved! simple actually... removed head , left in body...
<script type='text/javascript'> $(function () { function initializeevents() { /* new category */ $('#new_admin_category').on('ajax:success', function (event, data, status, xhr) { $("#dashboard_categories").html(data.html); initializeevents(); }); /* delete category */ $('a[data-remote]').on('ajax:success', function (event, data, status, xhr) { $("#dashboard_categories").html(data.html); initializeevents(); }); } initializeevents(); })(); </script>
Comments
Post a Comment