Hi, anybody can tell me please how to Get xmlHttp.responseText when you call from IFrame?

I get empty xmlHttp.responseText, while when calling server from out the IFrame, I get the responseText without problem, how can I solve this problem? Thanks.

<iframe>

<input type="button" onclick="CallServer()">

</iframe>

To makes things clear:

Note: I am loading the IFrame content dynamically with the page (source) (IFrameSRC.php), IFrameSRC.php contains the html elements and the button which I click to call the AJAX. <IFrame src="IFrameSRC.php"></IFrame>


Inside page IFrameSRC.php:
<input type="button" onclick="CallServer()">

By the way when I call the server without the IFrame, it works perfect and I am able to get the response text from the AJAX file... Can any body helps me out with this? Thanks.

Thanks a lot!

Any hint guys? I am still waiting.. Thanks.

if you have a button in an iframe which is on your parent page, then you have to write a function that calls that xmlHttp.responseText on that parent page. Try this, on the iframe page that is being loaded, put

function loadpage(url) {
     parent.changepage(url);
}

parent page

function changepage(url){
document.getElementById("id").src = url;
}

This is to give you an example on how to call a javascript from your iframe to your parent page.

Thanks guys but I am not using the IFrame anymore, I am using the AJAX and normal DIV :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.