I am trying to get data from one php page and pass it to another page using Ajax.
JS :
$.ajax({
url: \"action.php\",
succes
To get data as response in ajax call, you need to echo
the result from your php page; action.php page.
echo $test = 1;
In your provided code
$.ajax({
url: "data.php?id=data"
} // closing bracket is missing
you are sending the string data as id
to data.php page. Instead you have to append the result with the url using +
symbol like shown in the below code.
$.ajax({
url: "action.php",
success: function(data){
$.ajax({
url: "data.php?id="+data
})
}
});