[英]load another php page dynamically in jquery ui on click of a button
jQuery(function ($) {
// Load dialog on page load
// Load dialog on click
$('#basic-modal .basic').click({
modal:true,
open: function ()
{
var id = $('#id').attr('value');
$(this).load('edit.php?id='+id);
},
height: 400,
width: 400,
title: 'Dynamically Loaded Page'
});
});
This is not opening the dialog on the click of the button. 单击按钮不会打开对话框。 what is it that i am doing wrong here?
我在这里做错了什么?
You are passing options from jQuery UI .dialog()
to .click()
. 您正在将选项从jQuery UI
.dialog()
传递到.click()
。 Try this: 尝试这个:
jQuery(function ($) {
// Load dialog on page load
// Load dialog on click
$('#basic-modal .basic').click(function(){
$('<div id="dialogContainer"></div>').appendTo('body').dialog({
modal:true,
open: function ()
{
var id = $('#id').attr('value');
$(this).load('edit.php?id='+id);
},
height: 400,
width: 400,
title: 'Dynamically Loaded Page'
});
});
});
try doing things in reverse 尝试反向做事
function getEdit(id)
{
$.get("edit.php", {id: id}
function(data)
{
$("#div-id").html($("#div-id").html() + data)
$("#div-id").dialog({
modal:true,
height: 400,
width: 400,
title: 'Dynamically Loaded Page'
});
},
"html");
}
getEdit(); // you can also set up a button to call this as well.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.