javascript - how to call a function newly added from ajax

Posted by strike_noir on Stack Overflow See other posts from Stack Overflow or by strike_noir
Published on 2012-06-24T21:08:32Z Indexed on 2012/06/24 21:15 UTC
Read the original article Hit count: 210

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery