jquery long-poll not displaying anything -


for reason following not displaying @ - idea did wrong?

update 1:

index.php

$(document).ready(function(){   (function poll(){     $.ajax({ url: \"getdbdata.php\", success: function(data){       document.write(data.timestamp);     }, datatype: \"json\", complete: poll, timeout: 30000 });   })(); }); 

getdbdata.php

$response = array(); $response['timestamp'] = time()+microtime(); echo json_encode($response); sleep(1); 

original code:

index.php

<?php  echo " <html> <head>  <script src=\"jquery.min.js\" type=\"text/javascript\" charset=\"utf-8\"></script>  <script type=\"text/javascript\">   $(document).ready(function(){   (function poll(){     $.ajax({ url: \"getdbdata.php\", success: function(data){       var json = eval('('+data+')');       if json['timestamp'] != \"\" {         document.write(json['timestamp']);       }, datatype: \"json\", complete: poll, timeout: 30000 });     })();   }); </script>  </head> <body> </body> </html>  "; //end of echo ?> 

getdbdata.php

<?php   $response = array();    ($testloop=0; $testloop < 100; $testloop++) {     $response['timestamp'] = time()+microtime();     echo json_encode($response);     sleep(1);   } ?> 

i can't figure out i'm going wrong this...


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -