I'm using axios get to fetch data by sending parameter request body and ran into this issue:
console.log("Submitted!");
console.log(latitude);
console.log(longitude);
axios.get('http://127.0.0.1:8000/api/real-estate/apartment-sale-hanoi-price/predict', {
"latitude": latitude,
"longitude": longitude
})
.then(response => {
predict_price = response.data.predicted_price;
console.log("predicted_price: " + predict_price);
/*
popup_content = popup_content + `<br>` + `Predicted: ` + predicted_price;
selected_marker.bindPopup(popup_content).openPopup();*/
})
.catch(error => console.log(error));
My API endpoint returns a JSON object containing predicted_price. It worked when I tested on Thunder client
I think it may have something to do with how I pass the parameter body in the get request.
Previously I tried data and params props inside axios but still the same error. Something might have gone wrong on the client side.
I tried many different Content-Type like json, form-data... but nothing worked so far!
Could you show me a way to solve this?