Why can't ajax receive the value returned by PHP? the request is successful, but even if the alert does not come out, the console.log will not come out.

Mar.13,2021

17 line, change return json_encode to echo json_encode


check the error report. There is something wrong with your url route. Do you want to adjust the charge_index method?


if you say you have no problem, then you can see if the return format in network is not standard json, request at all, and has not reached success. Ajax

var_dump(charge_index());
Change

to

echo charge_index();

1. Write the success callback and error callback of ajax to facilitate debugging problems, but don't save trouble
2. Change var_dump to echo
3. json_encode the second parameter is not true/false

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea83b0-1eb9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea83b0-1eb9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?