jquery - Value from Ajax shows in console but it's not working as a Php value -


i've got little question regarding usage of ajax. i've done search same issues can't find alike problem.

here 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 php file have

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

the console shows should. appreciated.

the console logging variable sending not you're receiving, why looks correct. if log response you'd see problem.

for php part you're reading $_post['data'] when should reading $_post['numeform'] becuse sent in ajax request

{numeform : numeform}


Comments