我试图在jQuery中使用文件名,我面临的问题是找不到文件,是因为重写文件吗?当我尝试使用完整的url时,效果很好。。
我试过了,但不起作用
$.ajax({
type: 'POST',
url: 'inentry.php',
data: $("#myform").serialize(),
success:function(data)
{
}
});
我试过这个和这个工作
$.ajax({
type: 'POST',
url: 'http://localhost/mgosoft/admin/inentry.php',
data: $("#myform").serialize(),
success:function(data)
{
}
});
为什么我不能直接访问文件?我的htaccess文件有问题吗?
.htaccess
RewriteEngine On
RewriteBase /mgosoft/admin/
RewriteCond %{THE_REQUEST} ' /+mgosoft/admin/index'.php'?p=([^' &]+)&?([^' ]*)
RewriteRule ^ /mgosoft/admin/%1/?%2 [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ index.php?p=$1 [L,QSA]
对于您的本地版本,添加
<base href="//localhost/mywebsite" />
至头部
对于您的实时版本,请将其更改为
<base href="//your.domain.here" />
参考http://www.w3.org/TR/html4/struct/links.html#h-12.4