$ .post函数错误

$(".eventer button[name=lol]").click(function() { 
    console.log('clicked'); 
    thisBtn = $(this); 
    parent = $(this).parent(); 
    num = parent.data('num'); 
    id = parent.data('id'); 

    if(typeof num != 'number'){ 
        num = 0; 
    } 

    $(this).attr('disabled', true); 
    $.post(
        'javas.php', 
        {
            num: (num+1), 
            id: id
        },
        function(data) { 
            console.log('Ajax     success'); 

            parent.next('.status').html(num);  
            thisBtn.attr('disabled', false); // reset  });

            console.log('Ajax success'); 
            parent.data('num', ++num); 
            parent.next('.status').html(num); 
            thisBtn.attr('disabled', false); // reset 
        }
    );
}); 

console.log('-- end'); 

I get an undefined error index in javas.php, num is not being sent correctly to the page and furthermore the html snippet from javas.php is not being displayed in .status class as it should.

This is the javas.php page, num should be getting posted here and then the echoing should take place in the correct status class on the main page but this is not happening, only the value of num is being displayed on the main page.

<?php
   $lol =  $_POST['num'];
   echo " $lol haha lol cakes";
?>

The reason the snippet from the PHP script is not being displayed is because of this line:

parent.next('.status').html(num);

That is setting the status class to display the number you posted, not the returned data.

Change it to this

parent.next('.status').html(data);