{"action":"created","issue":{"url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/560","labels_url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/560/labels{/name}","comments_url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/560/comments","events_url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/560/events","html_url":"https://github.com/defunkt/jquery-pjax/issues/560","id":102130001,"number":560,"title":"Pjax breaks my javascript plugins","user":{"login":"Eschwinm","id":13255480,"avatar_url":"https://avatars.githubusercontent.com/u/13255480?v=3","gravatar_id":"","url":"https://api.github.com/users/Eschwinm","html_url":"https://github.com/Eschwinm","followers_url":"https://api.github.com/users/Eschwinm/followers","following_url":"https://api.github.com/users/Eschwinm/following{/other_user}","gists_url":"https://api.github.com/users/Eschwinm/gists{/gist_id}","starred_url":"https://api.github.com/users/Eschwinm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eschwinm/subscriptions","organizations_url":"https://api.github.com/users/Eschwinm/orgs","repos_url":"https://api.github.com/users/Eschwinm/repos","events_url":"https://api.github.com/users/Eschwinm/events{/privacy}","received_events_url":"https://api.github.com/users/Eschwinm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-20T12:43:55Z","updated_at":"2015-12-09T10:57:53Z","closed_at":null,"body":"Good afternoon,\r\n\r\nI was implementing Pjax into my website but whenever I add it to a #pjax-container it will break my javascript.\r\n\r\nI have come to the conclusion because I Have one main.js where every plugin will be initialized within a document.ready function. When a Pjax page will get loaded from the source the document will not reload so the document ready won't fire a second time.\r\n\r\nWhen I make one large function from all the initializing plugins called Init(); and I will call this on pjax:success it will initialize every plugin again and again on every page visit. This will cause some errors with some of my plugins.\r\n\r\nMy plugins contain of custom plugins (I make a plugin for the smallest chunks of codes and I will initialize is after in main.js).\r\n\r\nWell, now there is only content in #pjax-container containing html, ckeditor stuff, some datatables stuff etc.\r\n\r\nWhenever Pjax gets content from a new page from the corresponding page's #pjax-container it will not initialize all the elements on the corresponding page's contents.\r\n\r\nAlso when I got back and forward in my website the website breaks and all plugins won't work anymore.\r\n\r\nThere are no errors generated but every element just does nothing because there is nothing binded to all those 'new' elements from the Pjax corresponding page.\r\n\r\nIs there any info about this ? I couldn't find any info about this on the web.\r\n\r\nIf anyone has suggestions about how to tackle these problems please let me know.\r\n\r\nMy structure is:\r\n\r\n[head]\r\n  -- head stuff including some css and font files\r\n[/head]\r\n[body]\r\n    [div id=\"pjax-container\"]\r\n        -- random stuff from my plugins and ckeditor stuff\r\n    [/div]\r\n\r\n-- all javascript files being included here\r\n[/body]\r\n\r\n[] are replaced with <>"},"comment":{"url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/comments/163188537","html_url":"https://github.com/defunkt/jquery-pjax/issues/560#issuecomment-163188537","issue_url":"https://api.github.com/repos/defunkt/jquery-pjax/issues/560","id":163188537,"user":{"login":"sea129","id":3500709,"avatar_url":"https://avatars.githubusercontent.com/u/3500709?v=3","gravatar_id":"","url":"https://api.github.com/users/sea129","html_url":"https://github.com/sea129","followers_url":"https://api.github.com/users/sea129/followers","following_url":"https://api.github.com/users/sea129/following{/other_user}","gists_url":"https://api.github.com/users/sea129/gists{/gist_id}","starred_url":"https://api.github.com/users/sea129/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sea129/subscriptions","organizations_url":"https://api.github.com/users/sea129/orgs","repos_url":"https://api.github.com/users/sea129/repos","events_url":"https://api.github.com/users/sea129/events{/privacy}","received_events_url":"https://api.github.com/users/sea129/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T10:57:53Z","updated_at":"2015-12-09T10:57:53Z","body":"a hack will be adding a function of all initialization of plugins inside the pjax container, wrap with <script> tag"}}