I have the following code in a javascript:

  $("#myForm").load('/path/to/html/page.htm');

In the html file there is this code:

<a href="javascript:cilogon.submit();">Media Library</a>
<form name="cilogon" action="http://xxxx.xxxx.com/xxx/login.do" method="post"     target="_blank">
    <input name="username" value="xxxx" type="hidden">
    <input name="password" value="xxxx" type="hidden">
    <input name="login" type="hidden">
</form>

So I try to load the form into the page with the .load statement. In IE10 and later the form tags do not load. Only the a and the input fields are loaded into the page. In all other browsers it works, including IE9 and below. Any idea?

有帮助吗?

解决方案

I have found the solution myself now. It can be found using this link: http://forum.jquery.com/topic/is-jquery-stripping-form-tags

What I did is exchange the jQuery call with this one here:

        $.get("/link/to/html/file/with/form/file.htm", function (data) {
        $("#myForm")
            .html('')
            .append(data);
        });

It seems that the .html I used above strips out the form tag. I don't know if it's a problem with IE or with jQuery but if I use the $.get instead the $.load and .append instead of .html, it works.

Hope this helps.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top