来自Ajax的值显示在控制台中,但它不是作为Php值工作

i've got a little question regarding the usage of Ajax. I've done a search for the same issues but i can't find something to look alike with my problem.

Here is my code.

$(document).ready(function()
{
$("#nume").blur(function() { 

numeform = $("#nume").val(); 

if (numeform){  
    $.ajax({
    type: "POST",
     url: "../../index.php",
         data: {numeform : numeform}, 
         cache: false,
        success: function(response) {
            data = numeform;
            console.log(data);                           
        } 
      });
    }
});
});

and in the php file i have

$data = $_POST['data'];
echo $data; 

The console shows as it should. Any help is greatly appreciated.

The console is logging the variable you are sending not what you're receiving, that is why it looks correct. If you log response then you'd see a problem.

For the PHP part you're reading $_POST['data'] when you should be reading $_POST['numeform'] becuse that is what you sent in your ajax request

{numeform : numeform}