Ajax request PHP Error 404 But the script will be able to output the problem of data resolution method
1. Scene
Ajax requests that the PHP script return a 404 status Code, but the PHP script can output the data, causing the Ajax callback function to fail to execute.
Troubleshooting process:
1, the suspicion is that the framework of their own problems, in the browser window request Ajax Request script path, the page can open normally.
2, write a PHP script, directly output a JSON-formatted string, with the AJAX request, still return the status code of 404.
3. Write an HTML page with an AJAX request and return a status code of 405.
4, troubleshooting Nginx configuration parameters, found that there are problems with fastcgi configuration.
Workaround:
Location ~ \.php$ { root html; Fastcgi_pass 127.0.0.1:9000; Fastcgi_index index.php; Fastcgi_param script_filename /scripts$fastcgi_script_name; Include fastcgi_params; }
Change to
Location ~ \.php$ { root /www; Fastcgi_pass 127.0.0.1:9000; Fastcgi_index index.php; Fastcgi_param script_filename /www/$fastcgi _script_name; Include fastcgi_params; }
What to modify:
Root runs the root directory for the Web site.
/scripts changes to the Web site root directory.
http://www.bkjia.com/PHPjc/990599.html www.bkjia.com true http://www.bkjia.com/PHPjc/990599.html techarticle Ajax request PHP error 404 But the script can normally output data problem Resolution 1, the scene Ajax request PHP script returned 404 status code, but the PHP script can output data, resulting in the return of Ajax ...