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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -