I have a script in php that displays the content and add another content one in a one second. I want to get this effect in Jquery ajax, unfortunately the text is displayed complete. How to load content on the live in ajax?
My Jquery code:
<div class="div"></div>
<script src="//code.jquery.com/jquery.js"></script>
<script>
$(document).ready(function(){
$.ajax({
url: 'content.php',
type: 'post',
data:{
name: 'name'
},
success: function(r){
$('.div').html(r);
}
})
});
</script>
content.php
<?php
echo "one";
ob_end_flush();
flush();
sleep(1);
echo $_POST['name'];
?>