I have index.php , indexTwo.php , In indexTwo.php I'm making ajax request that get data from database by ajax , Now I want to transfer that data from indexTwo.php to index.php , how it can be acheived by ajax ? I even tried in index.php in results div, but it didn't show , and when I returned data from index.php and alert it I found Users is in results div , so I'm confused , what should I do to make them appear in results div?
function RedrawDiv(){
$.ajax({
type : "post",
url : "Recive.php",
success : function(data){
$.ajax({
type: 'POST',
url: 'index.php',
data: { Users : data },
success: function(res)
{
$('#results').html(res); //Results div in index.php
}
});
}
});
}
$(document).on("click","#ClickTwo",function(){
RedrawDiv();
})
return false;
});
//Echo them throught $_POST
<div id="results">
<?php
if(isset($_POST['Users'])){
echo $_POST['Users'];
}
?>
</div>