How can i access javascript functions from ajax loaded content on the same page? -


1) on main page have javascript function

function editsuccess(data) { alert("editsuccess called"); }

2) main page load content div using ajax need call javascript function loaded content it's don't see editsuccess function

this should work long editsuccess available in global scope. remember javascript has function scope, if define editsuccess inside function, available within function. consider example:

// javascript window.onload = function() {     function editsuccess() {         alert("hello");     } };  // html <div onclick='editsuccess()'>..</div>  // or <script>editsuccess()</script> 

will not work since editsuccess not exist in global scope.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -