views:

136

answers:

2

Hello,

I have a web page that has a DIV and an IFRAME. When a user clicks a button in my DIV, I need to submit the web form that is hosted in my IFRAME. Both pages are hosted on the same server in the same directory. My code that attempts to submit the web form looks like this:

$("#myIFrame").contents().find("form").submit();

When this code is called, I receive an error in IE that says: "Internet Explorer cannot display the webpage"

In FireFox when I execute the code, I receive an error that says: "The connection was reset"

In FireFox when I look at the error console I see: "Error: Permission denied for http://localhost:2995 to get property HTMLDocument.nodeType from ."

What am I doing wrong?

+1  A: 

I made a short test using the frameReady plug-in:

$("#extsumbit").click(function(event){
    $.frameReady(function(){
        $("#frameform").submit();
    }, "top.myiframe");
});

This way you can access the content inside the iframe transparently using jQuery selectors.

aeby