Bir web uygulaması geliştiriyorum ve bir JSON verisi döndüren sunucu tarafı dili php kullanıyorum, burada PHP betiğini döndürüyor JSON veriler:
<?php
require_once "connection.php";
if (isset($_GET['take'])) {
$res = $conn->query('select * from pas where service=1');
}
if ($res->num_rows > 0) {
$arr = array();
while ($row = $res->fetch_assoc()) {
array_push($arr, $row);
}
header("Content-type: application/json");
echo json_encode($arr);
}
javascripte kodudur:
$.get('../controllers/sap.php?take=1', function(data) {
console.log(data); //printing the result here
console.log(data);
});
o çalışıyordu dün, yani PHP sayfası döndürdü sonucudur olsa ....
Hangi HTML dönüyor? Örneğin bir hata sayfası mı? – Chris
@Chris, bir hata yazamadığım php sayfasını döndürüyor –
Yani PHP'yi işlemiyor mu? Sadece PHP kodu geri mi geliyor? – Chris