I have a page where I load an iframe and in that iframe, i have an onclick that looks like this onclick="javascript:ajaxpage('http://localhost/project/includes/php/add-images.php?src=" . $oname . "&dsc=" . $dsc . "', 'add-images');" The problem is that the "add-images"-DIV is not in the iframe, it's on the page that loads the iframe, are there any way to make this work, or do I have to find another way of doing it? Thanks in advance!
You need to set the target to the iframe. To be of more help, I need the code for the ajaxpage() function.
Here's that function: function ajaxpage(url, containerid) { var page_request = false if (window.XMLHttpRequest) // if Mozilla, Safari etc page_request = new XMLHttpRequest() else if (window.ActiveXObject){ // if IE try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ page_request = new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } } else return false page_request.onreadystatechange=function(){ loadpage(page_request, containerid) } page_request.open('GET', url, true) page_request.send(null) } Code (markup):