My return is always zero. I can't seem to work. How can I use native-native with php with fetch json. can anyone help?
Php
$myArray = array(); $myArray['lat'] = $_POST['lat']; $myArray['lng'] = $_POST['lng']; echo $_POST['lat'];
Jet sampling
fetch(url, { method: 'post', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({ lat: region.latitude, lng: region.longitude }) }) .then((response) => response.json()) .then((responseData) => { console.log(responseData); }) .catch((error) => { console.warn(error); }) .done();
source share