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

Could jquery's dialog modal change page inside modal?

你好,我尝试让 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>

尝试使用以下代码:

$(document).ready(function() { 

     var dlg=$('#dialog').dialog({
        title: "jQuery Dialog",
        resizable: true,
        autoOpen:false,
        modal: true,
        hide: 'fade',
        width:350,
        height:275
     });


     $('#btn').click(function(e) {
         e.preventDefault();
         dlg.load('test3.php', function(){
             dlg.dialog('open');
         });
      }); 
});

在 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

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