Php 403禁止的错误-执行和ajax页面
我有一个网站,一切正常。但我只有在从php调用ajax页面时才会出现以下错误Php 403禁止的错误-执行和ajax页面,php,jquery,error-handling,Php,Jquery,Error Handling,我有一个网站,一切正常。但我只有在从php调用ajax页面时才会出现以下错误 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>403 Forbidden</title> </head><body> <h1>Forbidden</h1> <p>You don't have permiss
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access test.php
on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
<hr>
<address>Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at salarypayroll.com Port 80</address>
</body></html>
更改test.php文件的权限当test.php文件不存在或test.php文件的路径无效时,会发生此错误
检查ajax代码中的文件路径。我也有同样的问题 它是由查询字符串中的特殊字符引起的 在您的情况下,可能是通过{inside data
您应该检查apache重写规则。确保您的主机允许在表单post中使用http URL。一些主机部署mod_sec规则,以防止通过post传递http://URL。向我们展示如何从phpPost调用ajax页面,以及如何从浏览器直接访问test.php?相同的权限页面?
function myfunc(){
var test = $("#test").val();
$.ajax({
type: 'POST',
url: 'test.php',
data:{
"test" : test,
},
success: function(data)
{
/*--------My code-------*/
}
});
}