首先在您的中添加一些CSS以使模式框看起来正确:
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
然后,稍微修改load_modal.js文件:
$(document).ready(function() {
$("#dialog").dialog({
autoOpen: false,
modal: true,
width: 600,
height: 400,
buttons: {
"Close": function() {
$(this).dialog("close");
}
}
});
$(".modal").on("click", function(e) {
e.preventDefault();
$("#dialog").html("");
$("#dialog").dialog("option", "title", "Loading...").dialog("open");
$("#dialog").load(this.href, function() {
$(this).dialog("option", "title", $(this).find("h2").text());
//$(this).find("h1").remove();
});
});
});