prakash Posted October 15, 2007 Share Posted October 15, 2007 hi, How can I update loop output data on ajax. here is the two file that I am testing sampleloop.php <?php header("Content-Type: text/html; charset=ISO-8859-15"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ignore_user_abort(TRUE); $total=5; for ($i=1; $i<=$total; $i++) { $percentage=($i/$total)*100; print "Sending $i of $total [$percentage%]...<div class=progress><img src=progress.jpg width=$percentage% height=20 alt=progress... title=progress...></div>"; usleep(1000000); // stop for 1 second } ?> index.php <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> <script type="text/javascript" language="javascript" src="ajaxrequest.js"></script> <title>AJAX Test</title> </head> <body> <div id="main"> <!-- all results appears dynamic within the div like right here --> </div> <p><a href="javascript: MyAjaxRequest('main','sampleloop.php')">Click to Test Loop</a></p> </body> </html> currently index.php is making all the output at once. But I want to display the loop result each time replacing the old one. How can it be possible. Quote Link to comment Share on other sites More sharing options...
prakash Posted November 4, 2007 Author Share Posted November 4, 2007 isn't there any solution for this ?? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.