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
Post a Comment