简体   繁体   English

jQuery对话框中的页面

[英]page in jquery dialog box

I have dataTable which last column for edit. 我有dataTable的最后一列进行编辑。 I have a separate page for edit form. 我有一个单独的页面用于编辑表单。 what i want is when edit link is clicked open that page in a jQuery dialog box and submit data. 我想要的是单击编辑链接时在jQuery对话框中打开该页面并提交数据。

The correct way to solve this problem 解决此问题的正确方法

Assuming that you want a popup or a more specific term modal to edit the form, you should not have a separate html view for that but actually make a general form and post data using ajax. 假设您要使用弹出窗口或更具体的术语modal来编辑表单,则不应为此设置单独的html视图,而应使用ajax实际上创建常规表单并发布数据。 Creating a separate page defeats that purpose. 创建单独的页面无法达到目的。

Now assuming that you still want to have a separate page for that. 现在,假设您仍然想要一个单独的页面。 The modal should be like 模态应该像

<div class="modal">
    <iframe src="" id="frameSrc">
    </iframe>
</div>

where the src contains the url of the page that you want to open, i am guessing from the href . 我想从href那里src包含您要打开的页面的URL。 So here is how you would do that in javascript 所以这是您将如何在javascript中进行的操作

$(this).on("click", function () {
    var editUri = $this.attr('href');
    document.getElementById('frameSrc').src = editUri;
});

The javascript will get the url from href and substitute the src in iframe tag in modal. javascript将从href获取网址,并以模态替换iframe标签中的src

Hope this helps.. 希望这可以帮助..

you can do this without alert and you don't need send href to jquery use fadeIn and some style to make it. 您可以在没有警报的情况下执行此操作,并且不需要使用hrefIn和某种样式将href发送到jquery。

 $('a#login').click(function(){ $("#bgstyle").fadeIn('slow'); $('form').fadeIn('slow'); }) 

Fiddle DEMO hope this help you 小提琴模拟演示希望对您有帮助

anyway if i wanna do this i prefer to use bootstrap modal. 无论如何,如果我想这样做,我更喜欢使用引导模态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM