Amoraboti - Program
Rashed - Uz - Zaman (Rasel)
  Home About Me Brainstorming Facebook Fan Page Contact    
  Author
I'm Rz Rasel
From Bangladesh

  Archives
April 2010
May 2010
January 2011
February 2011
January 2012
February 2012
March 2012

  Current

  Previous Posts
Show Message In Cursor Pointer
Resizing images with PHP
JavaScript Blinking Title
JavaScript Scrolling Title
JavaScript Ad Display
JavaScript Tool Tip
Fixed Bar At The Bottom Like Facebook
Fixed Bar At The Bottom Like Facebook
Connect to MySQL using C# and Connector/Net
Send Email (smtp.gmail.com) Using C Sharp

  My Link
Islam And We
My Diary (Bangla)
My Diary (English)
My Lyrics (Bangla)
My Lyrics (English)
My Poem (Bangla)
My Poem (English)
My Story (Bangla)
My Story (English)
General Knowledge
Fun And Jokes
Lyrics (Bangla)
Lyrics (English)
Lyrics (Hindi)
Quotations
 
 
  Ajax getting xmlhttprequest to loop continuously  
  Sunday, January 30, 2011  
 
//-------------------- live.php
// First detect browser-type, as some browsers are picky.
if (strstr($_SERVER['HTTP_USER_AGENT'], 'Safari'))
{
// Safari required at least 1024 bytes before displaying
echo str_pad('',1024);
$browser = "safari";
}

// Begin our loop that only aborts if the client disconnects
while(!connection_aborted())
{
$i+=3;
// Safari requires a padding of 8 characters
echo ($browser = "safari" ? str_pad($i, 8) : $i);
// Output current data with flush()
flush();
// Sleep for 3 seconds
sleep(3);
}
?>

//-------------------- nStream.js
// set connection as a global variable
var connection = null

function nStream(url)
{
setInterval(nParse, 1000);
if (!/*@cc_on!@*/false)
{
connection = new XMLHttpRequest();
}
else
{
connection = new ActiveXObject("Microsoft.XMLHTTP");
}
connection.open("GET", url, true);
connection.onreadystatechange = function()
{
if (connection.readyState == 4)
{
alert('connection closed.');
}
}
connection.send(null);
}

oldResponse = null;
function nParse()
{
var Response = connection.responseText;
if (Response != oldResponse)
{
document.getElementById('change').innerHTML = Response;
}
oldResponse = Response;
}

//---------------------------------------------------------

 
  posted by Rz Rasel At 1:38 AM,

0 Comments:

Post a Comment

<< Home

 
     
 
  Problem In Font
Download then zip file unzip and install in your system. Or normal font file just install in your system font folder. Rz Rasel
Bangla Font
Bangla Font

  Find Me In Facebook
 
 

   aaaa
 

   aaaa
 
 
Copyright © 2010 - Amoraboti - Program. ® All right reaserved. Design and developed by:- Rz Rasl