jquery-ajax没有发布数据

Refer to the following code, this script doesn't post the "limit" variable to the next page

MY JS Code:

$(document).ready(function(){
         $(window).scroll(function() {
                    if ($('body').height() <= ($(window).height() + $(window).scrollTop())) {
                       var dataString="2";
                       $.ajax({
                          type:"POST",
                          url: "load_data.php",
                          data: { 'limit': dataString },
                          success:function(data) {
                             $('#leftNews').load('load_data.php'); 
                          }
                       });
                    }
         }); 
});

PHP CODE

<?php
    if(isset($_POST['limit'])) {
        echo $_POST['limit'];
    }
    else echo 'asd';
?>

Everytim i run this i get "asd" printed

That's because you're loading the PHP page, instead of loading the result.

$(document).ready(function() {
    $(window).scroll(function() {
        if ($('body').height() <= ($(window).height() + $(window).scrollTop())) {
            var dataString = "2";
            $.ajax({
                type: "POST",
                url: "load_data.php",
                data: {'limit': dataString},
                success: function(data) {
                    $('#leftNews').html(data);
                }
            });
        }
    });
});

You make two different ajax requests. The first one is a POST-request with limit-variable set. The more important one is the second one, it is a load-requests (which is a get-requests without any parameters). Of course, your last request which shall print out the result does not containt any parameters, thats why "asd" is printed - the limit is NOT set!

In order to get the wanted result, you should change it to:

success:function(data) {
    $('#leftNews').html(data);
}