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 >
<body>
<div class="container-fluid">
<div class="row">
<h3>this is heading</h3>
<div class="mini">
<ul>
</ul>
</div>
</div>
</div>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/my_script.js"></script>
</body>
my_script.js code >
(function($){
$(function(){
$(".mini ul").append("<li>Bangladesh</li><li>Chittangong</li>");
});
}(jQuery));
result is >
this is heading
Bangladesh
Chittangong
now, index2.php code >
<body>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/ck.js"></script>
</body>
ck.js code >
(function ($) {
$(function () {
$.ajax({
type:"GET",
url:"index3.php",
beforeSend:function(){},
success:function(html){
var xyz=$(html).find(".mini").html();
console.log(xyz);
}
});
});
}(jQuery));
result >
I have 2 questions, why
Thanks all and sorry for my poor English.