关闭简单模式时重新提交表单数据

发布于 2024-09-08 10:05:37 字数 914 浏览 0 评论 0原文

我正在打开一个简单的模式并使用以下函数进行 Ajax 调用。

function TransactionModal($id, $s) {
        jQuery("#dialog").load("/chat/rejoin", { 'id': +$id, 's': +$s }, function()
        {
          jQuery("#dialog").modal({
          overlay:80,
          autoResize:false,
            containerCss: {width: "490px", height: "538px"},
          overlayCss: {backgroundColor:"#000"}
          });
        });
    }

因为我在要加载的页面中运行了一些 Javascript,所以我需要使用 iframe,因此重新加入页面中有以下内容。

<IFRAME SRC="/chat/join/id/<?php echo $id; ?>/cid/<?php echo $cid;?>" width="500" height="535">
    <!-- Alternate content for non-supporting browsers -->
    Upgrade Browser to support iframes
</IFRAME>

这一切都很好。

我遇到的问题是,当我单击关闭按钮时,它正在重新提交表单数据。

我不知道为什么,但这让我发疯。

如果我刷新页面,模式就会消失并且不会重新提交。

如果我单击 X 图像将其关闭,它会重新提交。

如果您知道为什么这样做,请帮忙!

I'm opening a simple modal and making an Ajax call with the following function.

function TransactionModal($id, $s) {
        jQuery("#dialog").load("/chat/rejoin", { 'id': +$id, 's': +$s }, function()
        {
          jQuery("#dialog").modal({
          overlay:80,
          autoResize:false,
            containerCss: {width: "490px", height: "538px"},
          overlayCss: {backgroundColor:"#000"}
          });
        });
    }

Because I have some Javascript running in the page I want to load, I need to use iframes, so the rejoin page has the following in it.

<IFRAME SRC="/chat/join/id/<?php echo $id; ?>/cid/<?php echo $cid;?>" width="500" height="535">
    <!-- Alternate content for non-supporting browsers -->
    Upgrade Browser to support iframes
</IFRAME>

That all works great.

The problem that I'm having is that when I click on the close button, it is resubmitting form data.

I have no idea why but it's driving me nuts.

If I refresh the page the modal goes away and doesn't resubmit.

If I click the X image to close it it does resubmit.

Please help if you have any idea why it's doing this!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆梦 2024-09-15 10:05:37
function rejoinModal($id) {

var src = '/chat/join/id/'+$id ;


jQuery.modal('<iframe src="' + src + '" height="555" width="510" style="border:0">', {
    containerCss:{
        backgroundColor:"#000",
        height:555,
        width:510,
        overFlow: "hidden",
    },

});

通过不在 ajax 调用中调用 iframe 解决了这个问题。

现在正在工作。

function rejoinModal($id) {

var src = '/chat/join/id/'+$id ;


jQuery.modal('<iframe src="' + src + '" height="555" width="510" style="border:0">', {
    containerCss:{
        backgroundColor:"#000",
        height:555,
        width:510,
        overFlow: "hidden",
    },

});

}

i solved it by not calling the iframe from withing the ajax call.

it is working now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文