As it stands, I have some JQuery along these lines -
ph=function(i){
$.each(i,function(po){
id=po.id;url="/"+id;t=$('<div id='+ id +' class=entry></div>');
t.html('<div class=hx><a href="/users/'+ po.author +'">'+ po.author +'</a></div><div class=b>'+ po.body +'</div>');
t.prependTo($("#modpskx"));
t.hide();
t.slideDown("slow");});};
function mtoxps(){
mid=$("#xsodl").val();
id=$("#modpskx > div:first")[0].id;
if(id==""){id=0}
$.ajax({
url:'/widgets/live.php',
data:{'id':id,'mid':mid},
type:'post',
dataType:'json',
cache:false,
success:function(b){ph(b);}});}
setInterval("mtoxps()", 10000);
The JSON data sent back to the browser by the server is as follows:
[{"author":"NiX","timestamp":"2009-12-20 21:35:32","id":"194","mig_id":"3","body":"Cows.","ip":""}]
This - every 10 seconds - successfully requests any new results. Unfortunately, the "ph" variable (what is used to return and display the result(s)) isn't properly parsing the returned output. Instead, it displays all the variables as undefined, resulting in the next request to send the server an "undefined" variable, as well.
Are there any suggestions as to why this isn't functioning?