I am working on a code where I am trying get the data from a mysql table using a filename through ajax GET request. The table "SAMPLE" contains img_name and x_value. I tried the following code:
index.php:
 var full = document.getElementById("img01").src;
 var file = full.replace(/^.*[\\\/]/, '');
 $.ajax({
   type:'GET',
   url: 'getfile.php',
   data:{
     'file':file,
     'xvalue':xvalue,
   },
   success: function(data){
     console.log(x);
   }
 })
getfile.php:
<?php
  $db = mysqli_connect('localhost', 'root', '', 'project_focus');
  $imagefile=$_GET['file'];
  $xvalue=$_GET['xvalue'];
  $updatename = "SELECT x_value FROM sample WHERE image_name='$imagefile'";
   mysqli_query($db,$updatename);
 ?>
In the above code, I tried to get the x_value from the table by using the filename in the variable "file" in index.php. But when I tried to print in the console it produces an error 'Uncaught ReferenceError: xvalue is not defined'. The expected result I would like to get x_value from the table using the filename that is in the variable "var file" .
I think I made some mistake with the Get request. Can someone help me to solve this problem
