I'm developing a web app and I'm using php as server side language which return a JSON data here is the PHP script that is returning the JSON data:
<?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);
}
the javascripte code is :
$.get('../controllers/sap.php?take=1', function(data) {
console.log(data); //printing the result here
console.log(data);
});
though yesterday it was working, that PHP page is the returned result....
我发现了问题,我是从intelliJDea IDE在与wamp服务器不同的端口上运行该应用程序的,而php在该端口上却不起作用,但是当我从wamp服务器运行该应用程序时,它就起作用了,因为php浪费了该解决方案永远无法运行一个PHP相关的应用程序,从任何一天的一天ID :)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.