0) { while ($services_row = mysqli_fetch_assoc($get_services_sql)) { $value = $services_row['branch_name']; $value_id = $services_row['id']; } } } // Set the return value in json format $returnValue = json_encode(array('val' => $value, 'id' => $value_id)); // Setting the header information to json format header('Content-Type: application/json'); // Display the information and return the control to the calling page echo $returnValue; ?>