不要求Jquery帖子

I have this code:

$(".user").click(function(){

    var s = $(this).attr('data-s');

    var r = $(this).attr('data-r');

    $.ajax({

        type: 'post',
        url: 'd/gcm.php',
        data: {s: s, r: r},
        success: function(cmd){
            $("#cet").show();
            $("#smd").attr("data-t",s);
            $("#smd").attr("data-tt",r);
            setInterval(function(){
                 $('#mcd').load('d/gcm.php');
            }, 100);


        }

    });

});

So on click post is requested. Inside gcm.php I have:

$s = mysqli_real_escape_string($con, $_POST['s']);
$r = mysqli_real_escape_string($con, $_POST['r']);
if($s!="" && $s!=NULL && $r!="" && $r!=NULL){ DO SOMETHING }else echo "Empty";

Now When I do this it works:

success: function(cmd){ .... and change interval with : $('#mcd').html(cmd); } Also when I try to add code above to interval nothing happens, script do not work. So I am wondering why I get message "Empty"; When it is after post request and post success?

.load() requests are GET requests. So you might change to jQuery.post() instead:

//setInterval(function(){
    $.post('d/gcm.php', {s: s, r: r}, function(d){
        $('#mcd').html(d);
    });
//}, 100);

and i don't think you should have a setInterval push here.

try this code use this to load after ajax success response

   $('.user').on("click",function(e){ 
      e.preventDefault(); // cancel click
      var page = $(this).attr('data-tt');   or 'data-t'
      $('#mcd').load(page);
   });