javascript - how to call a function newly added from ajax
- by strike_noir
I have a coding difficulty which have been asked in this forum before:
Calling a JavaScript function returned from a Ajax response
But I didn't find the answers quite satisfying. To be more precise of the problem I'm dealing, here is the details:
I dynamically load a document (HTML and javascript) using jquery
var url = 'document.php';
$('#container').load(url);
And then I want to call the functions from that document.php. Due to my requirement, I don't want to call the function after the documents' loaded, but rather to call it later when I need it. Because it was dynamically loaded, the DOM doesn't recognize the functions. How to properly call this function?
Thank you