GB_001 Posted March 5, 2008 Share Posted March 5, 2008 I tried targeting my AJAX to the parent document from a frame with this part of my AJAX function: ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.parent.getElementById('divvy'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } But it didn't work. What I know from my problem is that I'm targeting wrong. Can someone tell me what is the right way to target the parent frame? Thanks. -GB Quote Link to comment Share on other sites More sharing options...
mainewoods Posted March 6, 2008 Share Posted March 6, 2008 if the document is in a frame, then wouldn't the parent document be the top? (unless it is a nested frame) That doc would just be a frameset doc, so your innerHTML would not be valid I'm not sure document.parent is valid, it should be window.parent .It is best to leave it off because that is more cross browser compatable if you are calling one frame from another then it is best to just start from the top and go down: var ajaxDisplay = top.someframename.getElementById('divvy'); --the document in the frame targetted must be from the same domain as the calling document or it will not work - browsers stop it as a security violation Quote Link to comment Share on other sites More sharing options...
GB_001 Posted March 6, 2008 Author Share Posted March 6, 2008 I was try to call the the main document the frame was inside. Thankyou. -GB. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.