Ajax and javascript loading
Hello,
I'm using Ajax to load javascript functions and also HTML. In this HTML there is event like onkeyup that use the javascript function loaded. The code is added with an innerHTML = responseText.
When I don't use the Ajax loading everything works fine. I have read the Ajax pattern Javascript on Demand and then use an eval method. But still, I don't understand why it doesn't work.
I am looking for a simple example that works.
Those Javascript methods use the DOM to access the new loaded HTML code.
I wonder if it would be better to use responseXML to add the HTML code with another method instead of innerHTML.
About eval, how should I register my new functions ?
I've written self.myfuncname = function (myparam1, myparam2) {mycode here;}
is it OK ?
Then in my HTML code how do I use it ? onkeyup="myfuncname(param1,param2)" is it OK.
Thanks,
|