astrohelp
asked on
Calling a javascript function in an ajax page
I have a page that I use some ajax to call another page and place the results into the innerhtml of a div. I want to be able to call a javascript function from the returned html. Is this possible?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can register event handlers to items in the DOM by referencing them as properties.
eg - document.getElementById('p ollarea'). childNodes [childNode s.length]. onclick = doSomething; <--- notice you don't put () on the function as that would register the result to to the event, not the function itself.
eg - document.getElementById('p
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
...
ok...
I was having a bad day when I wrote this question, It was one of those days when the obvious seems impossible. I am going to award the points to both of you, I have no idea why this was a problem to me last night!
thanks!!!
ok...
I was having a bad day when I wrote this question, It was one of those days when the obvious seems impossible. I am going to award the points to both of you, I have no idea why this was a problem to me last night!
thanks!!!
ASKER
------------------------in
var ro;
var http = createRequestObject();
var urlid = "";
var urlid_ext = "";
function createRequestObject() {
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.X
}else{
ro = new XMLHttpRequest();
}
return ro;
}
function sndReq2() {
//urlid = url.substring(0,url.indexO
urlid_ext = "/poll.php?action=display"
http.open('get', urlid_ext);
http.onreadystatechange = handleResponse2;
http.send(null);
}
function handleResponse2() {
if(http.readyState == 4){
var response = http.responseText;
//var update = new Array();
//update = response.split('|');
//response = response.replace('%0A','*'
//alert(response);
document.getElementById("p
}
}
--------------------------
--------------------------
echo("<input type=radio onclick='function()' name=opts value=" . $poll_order . ">" . $opts . "<br>");
--------------------------
I would like the onclick in the requested page to call a function on the index page.
thanks again