Jquery ajax
Jquery ajax
i made a instant update feature on my web page with a ajax call using jquery..
<script type="text/javascript">
function getRandom()
{var instant=$.ajax({
url: "instant.php?fetch=1",
global: false,
beforeSend: function(xhr) {
xhr.setRequestHeader("Connection","Keep-Alive");
xhr.setRequestHeader("Keep-Alive",true);
},
async: false
}).responseText;
if(instant.length>6)
{
$('#instant_server_push').html(instant);
$('#instant_server').show(50);
var wall_id=document.getElementById('wall_childid').value;
$('#req',window.parent.document).load('requests.php');
$("#random",window.parent.document).load("postspace.php?wtype=U&userid="+wall_id).show(0);
setTimeout("$('#instant_server').hide(0);",4000)
}
callback();
}
function callback()
{
setTimeout("getRandom();",30000);
}
$(document).ready(getRandom);
</script>
this ajax call is made from an iframe which is hidden in my main page..
only if a response of length more than 6 is obtained, the frame will display the updates..
the problem is that when ever the ajax call is made.. the page stucksup for 1or2 sec.. if the user is typing something the action is also interupted..
Is there any way to solve this problem..