jQuery对话框打开另一个页面 [英] Jquery dialog to open another page
问题描述
有一个作为transaction.html的页面
There is a page as transaction.html
如何在另一个页面的弹出窗口中打开此页面,例如在jquery对话框中显示show_transactions.html
How to open this page in a popup in another page say show_transactions.html in a jquery dialog
$dialog.html() //open transaction.html in this dialog
.dialog({
autoOpen: true,
position: 'center' ,
title: 'EDIT',
draggable: false,
width : 300,
height : 40,
resizable : false,
modal : true,
});
alert('here');
$dialog.dialog('open');
此代码显示在show_transactions.html
This code is present in show_transactions.html
谢谢..
推荐答案
您可以使用jQuery的.load()
方法将页面加载到对话框中,方法如下:
You can use jQuery's .load()
method to load a page into a dialog, here's how:
$("#dialog").dialog({
autoOpen: false,
position: 'center' ,
title: 'EDIT',
draggable: false,
width : 300,
height : 40,
resizable : false,
modal : true,
});
$("#dialog_trigger").click( function() {
$("#dialog").load('path/to/file.html', function() {
$("#dialog").dialog("open");
});
})
这假设对话框的ID为"dialog",并且单击了另一个具有ID为"dialog_trigger"的元素以将其打开.您将两者都放入了文档的ready函数中,以便在页面加载时创建对话框,否则,将给用户带来轻微但可察觉的延迟.
This assumes the dialog has an ID of 'dialog' and that there's another element with ID of 'dialog_trigger' that is clicked to open it. You'd put both of these into your document's ready function so that the dialog is made on page-load, if it isn't, it will cause a slight-but-noticeable delay for the user as it's made.
这篇关于jQuery对话框打开另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!