可以在模态中使用jquery的对话框模态更改页面吗?

时间:2016-12-22 05:09:04

标签: javascript jquery jquery-ui jquery-ui-dialog

您好我尝试使jquery对话框弹出窗口(模态)可以更改为弹出窗口中的其他页面(在存在弹出窗口中加载其他页面)

但我不知道如何通过在test2.php中编码来加载模态中的test3.php

这是我的尝试

test1.php

 <!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Dialog - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

</head>
<body>
 <button id="btn">Click to Popup</button>

<div id="dialog" title="Basic dialog">
  here 
</div>
 <script>
    $(function () {
        $("#dialog").dialog({
            open: function(event, ui) {
             $('#dialog').load('test2.php', function() {
               alert('Load was performed.');
             });
           },
            modal: true,
            autoOpen: false,
            title: "jQuery Dialog",
            width: 600,
            height: 350
        });

    $("#btn").click(function(){
        $('#dialog').dialog('open');
    });
    });
 </script>


</body>
</html>

test2.php

this is test2.php page <br/>
<a href="test3.php"> Go to Page test3.php </a>

test3.php

<p> this is test3.php page </p>

2 个答案:

答案 0 :(得分:1)

在test1.php中试试这个

$(function () {
    $("#dialog").dialog({
        open: function(event, ui) {
        $('#dialog').load('test2.php', function() {
            $('#mylink').click(function(){
                $('#dialog').load('test3.php', function() {
                      alert('Load was performed.');
                });
             });
         });
       },
        modal: true,
        autoOpen: false,
        title: "jQuery Dialog",
        width: 600,
        height: 350
    });

    $("#btn").click(function(){
        $('#dialog').dialog('open');
    });
});

test2.php

&#13;
&#13;
this is test2.php page <br/>
<button id="mylink">Go to Page test3.php</button>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

尝试使用以下代码:

CREATE TABLE `bindings_copy` (
  `binding_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `record_id` smallint(5) unsigned NOT NULL,
  `game_id` smallint(5) unsigned NOT NULL,
  `layout_id` tinyint(3) unsigned NOT NULL,
  `key_number` tinyint(3) unsigned NOT NULL,
  `normal_action` varchar(128) DEFAULT NULL,
  `normal_group` tinyint(2) unsigned DEFAULT NULL,
  `shift_action` varchar(64) DEFAULT NULL,
  `shift_group` tinyint(2) unsigned DEFAULT NULL,
  `ctrl_action` varchar(64) DEFAULT NULL,
  `ctrl_group` tinyint(2) unsigned DEFAULT NULL,
  `alt_action` varchar(64) DEFAULT NULL,
  `alt_group` tinyint(2) unsigned DEFAULT NULL,
  `altgr_action` varchar(64) DEFAULT NULL,
  `altgr_group` tinyint(2) unsigned DEFAULT NULL,
  `extra_action` varchar(64) DEFAULT NULL,
  `extra_group` tinyint(2) unsigned DEFAULT NULL,
  `image_file` varchar(256) DEFAULT NULL,
  PRIMARY KEY (`binding_id`),
  UNIQUE KEY `binding_id_UNIQUE` (`binding_id`)
)
ENGINE=InnoDB AUTO_INCREMENT=16460 DEFAULT CHARSET=utf8
SELECT
    bindings.binding_id,
    records.record_id,
    bindings.game_id,
    bindings.layout_id,
    bindings.key_number,
    bindings.normal_action,
    bindings.normal_group,
    bindings.shift_action,
    bindings.shift_group,
    bindings.ctrl_action,
    bindings.ctrl_group,
    bindings.alt_action,
    bindings.alt_group,
    bindings.altgr_action,
    bindings.altgr_group,
    bindings.extra_action,
    bindings.extra_group,
    bindings.image_file
FROM bindings
left JOIN records
ON bindings.game_id=records.game_id and bindings.layout_id=records.layout_id;