Jquery ajax() method why did not get javascript text

I have 2 pages. One is index.php and other is index2.php. I have some text in index.php which put by append() jquery method. In my index2.php there is empty but I included ck.js in index2.php where I called ajax() method to get index.php text specially which was create by append() method.

by ajax() method I have got all data from index.php without which I was wanted.

index.php code >

        <div class="container-fluid">
            <div class="row">
                <h3>this is heading</h3>
                <div class="mini">
        <script src="js/jquery-3.2.1.min.js"></script>
        <script src="js/my_script.js"></script>

my_script.js code >

       $(".mini ul").append("<li>Bangladesh</li><li>Chittangong</li>");

result is >

this is heading


now, index2.php code >

        <script src="js/jquery-3.2.1.min.js"></script>
        <script src="js/ck.js"></script>

ck.js code >

(function ($) {
    $(function () {
                    var xyz=$(html).find(".mini").html();

result >

I have 2 questions, why

  • data not come and how can I get these ?
    Thanks all and sorry for my poor English.
  • Because there’s nothing there, it’s just a pair of <ul> tags with nothing in them. If you want list items, you need to actually have them on the page, they need to be in the html. The AJAX request just gets whatever is there, it can’t run random JavaScript on other pages, that would be a terrible idea