使用jQuery和PHP进行简单聊天

I'm not so good at English but I will give it a try, feel free to edit and improve my post!

I'm trying to create a little chat, now I do not want to reload when there's no new data. It will receive the data from update.php, this works correctly.

I'm trying to do a little check (sample to show what I want to accomplish):

This is standard:

var ok = update.php
load ok(4000s);

What I am trying to accomplish here is:

var ok = update.php
function timer{
var new = update.php
if(new != ok){
  ok = new;
},4000};

Of course this is fake code, it would never run, but it's the easiest way to explain what I mean.

  $(document).ready(function() {
                 $("#chatbox").html('').load("update.php");
                   var refreshId = setInterval(function() {
                    var xx = $("#chatbox").html('').load("update.php");
                    $('#holder').load('update.php');
                    if( xx != "#holder"){
                        $("#chatbox").html('').load('update.php');

                        // $("#chatbox").html('').load('update.php')
                        $("#chatbox").scrollTop($("#chatbox")[0].scrollHeight);  
                    }else{
                     alert)('nooope');
                    }
               }, 4000);
               $.ajaxSetup({ cache: false });
            });

I tried everything, still getting nope. (chatbox is a div, where de data gets loaded into.) (holder is the same concept, only this one is hided trough css, so that the user won't notice.)