php变量没有通过ajax调用[重复]回显

This question is an exact duplicate of:

I am having a problem with my code as my php variable is not being echoed on page when using ajax jquery. Here is my code...

<script>
    function refresh_div() {
     $('.loader').show();
     var username = "<?php echo $user; ?>";
     jQuery.ajax({
            type: "POST",
            url: "load.php",
            data:{user : username},
            success:function() {
                jQuery("#load_msgs").append(response+'<br>');

            },
            complete: function(){
        $('.loader').hide();
      }
        });
    }

    t = setInterval(refresh_div,1000);
</script>

i am trying to send "username" to page url "load.php"... i called it this way but nothing is being echoed...

if(isset($_POST['user'])) {
     echo $_POST['user'];
}

pls help out thanks... :)

edited...

when i tried using this code i.e adding passing response as parameter in success function like this ...

<script>
    function refresh_div(response) {
     $('.loader').show();
     var username = "<?php echo $user; ?>";
     jQuery.ajax({
            type: "POST",
            url: "load.php",
            data:{user : username},
            success:function() {
                jQuery("#load_msgs").append(response+'<br>');

            },
            complete: function(){
        $('.loader').hide();
      }
        });
    }

    t = setInterval(refresh_div,1000);
</script>

.... the data (username) gets displayed every second.. like a blink toggling on and off the page... how do i make the data display static in order to use the variable on the ajax page. Thanks :)

</div>

You are not defining response anywhere. Send it as the parameter of the success handler:

success: function(response) {
    jQuery("#load_msgs").append(response+'<br>');
},