Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- header("Content-Type: application/json; charset=UTF-8");
- $stmt = $mysqli->prepare($sql);
- $stmt->execute();
- $result = $stmt->get_result();
- $response = $result->fetch_all(MYSQLI_ASSOC);
- echo json_encode($response);
- /*$fp = fopen('datakomp.json', 'w');
- fwrite($fp, json_encode($response));
- fclose($fp);*/
- fetch('http://localhost:100/myreactappversi2/myapp2/public/data/tes2.php', {
- method: 'GET',
- headers:{
- 'Content-Type': ['application/json','charset=UTF-8'],
- },
- mode: "no-cors",
- cache: "no-cache",
- credentials: "include"
- })
- .then(response => response.json())
- .then(rowData => this.setState({rowData}))
- .catch(error => alert("Error : " + error))
Add Comment
Please, Sign In to add comment