Ajax requests php to report error 404, but the script can properly output data. Ajax requests php to report error 404, but the script can normally output data. Solution 1. the scenario ajax requests the php script to return a 404 status code, but the php script can output data, A solution that causes ajax to return ajax requests to php to report error 404 but the script can output data normally 
 
1. scenario
 
Ajax requests the php script to return a 404 status code, but the php script can output data, causing the ajax callback function to fail to be executed.
 
 
 
Troubleshooting process:
 
1. if you suspect that the framework you have written is faulty, request the ajax request script path in the browser window, and the page can be opened normally.
 
2. write a php script and directly output a json string. for ajax requests, the return status code is 404.
 
3. write an html page with an ajax request. the returned status code is 405.
 
4. check nginx configuration parameters and find that fastcgi configuration is faulty.
 
 
 
Solution:
 
 
 
 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
 
 
 
 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;        } 
Modification content: 
 
 
Root is the root directory of the website.
 
/Scripts to the root directory of the website.
 
 
 
 
 
 
 
 
 
 
 
Http://www.bkjia.com/PHPjc/990599.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/990599.htmlTechArticleajax request php error 404 but the script can normally output data problem solution 1, the scenario ajax request php script returns 404 status code, but the php script can output data, cause ajax back...