表单不会与iframe一起提交(使用ajax)

时间:2014-02-10 07:53:13

标签: javascript php ajax colorbox

我使用了colorbox(http://www.jacklmoore.com/colorbox/)来创建一个很酷的iframe弹出窗口。

iframe的弹出式广告href是在 ajax 电话后添加的。

当我进入弹出窗口并且我正在尝试提交表单时 - 它关闭(不输入$ _GET \ $ _ POST部分)。

我不得不补充道:

    $('a.iframe').colorbox({
                'transitionIn'    : 'elastic',
                'transitionOut'    : 'elastic',
                'titlePosition'    : 'over',
                'type'                : 'iframe'

});

因此弹出窗口将打开(在ajax之后,它没有打开没有这些行)。 怎么(以及为什么)我不能提交表格?它只是在没有这样做的情况下关闭弹出窗口。

我的完整ajax代码:

function loadInnerHTML(url,insertHere,id,table,key,whatParamToDisplay) 
{

    var xmlhttp;
    if(window.XMLHttpRequest) 
        xmlhttp = new XMLHttpRequest();
    else  // code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

    xmlhttp.onreadystatechange = function() {
        if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            document.getElementById(insertHere).innerHTML = xmlhttp.responseText;

            $('a.iframe').colorbox({
                'transitionIn'    : 'elastic',
                'transitionOut'    : 'elastic',
                'titlePosition'    : 'over',
                'type'                : 'iframe'

});

        }
    }

    if (id == null)
        xmlhttp.open("GET", url, true);
    else
        xmlhttp.open("GET", url+"&id="+id+"&table="+table+"&key="+key+"&whatParamToDisplay="+whatParamToDisplay, true);

    xmlhttp.send();
}

也许是同义词问题? 我该如何解决?

0 个答案:

没有答案
相关问题