This is my PHP Code contains an array of tokens
$date=$_POST['date'];
$query=mysqli_query($conn,"SELECT tokenno from at_booking where date='$date' and status='Booked'");
while ($row = mysqli_fetch_array($query)) {
echo json_encode($row);
}
This is my ajax respone code
date_input.change(function () {
$("#tokens").show();
var data=$("#date").val();
//alert("data"+data);
$.ajax({
type : 'POST',
url : 'tokens.php',
data : {date: data},
success:function(response){
alert("response= "+response);
}
});
});
Iam getting response like this
response= {"0":"Token1","tokenno":"Token1"}{"0":"Token2","tokenno":"Token2"}{"0":"Token3","tokenno":"Token3"}{"0":"Token4","tokenno":"Token4"}{"0":"Token5","tokenno":"Token5"}{"0":"Token6","tokenno":"Token6"}{"0":"Token8","tokenno":"Token8"}{"0":"Token7","tokenno":"Token7"}{"0":"Token9","tokenno":"Token9"}{"0":"Token10","tokenno":"Token10"}
I bit confused how to split the response and i have to get output "Token1" from {"0":"Token1","tokenno":"Token1"} and "Token2" from {"0":"Token2","tokenno":"Token2"}