laravel中的根文件夹重定向问题



我使用wamp服务器进行laravel。我的url是localhost/pjctname/public。我有ajax中的url,如下所示

$.ajax({
type: "POST",
dataType: 'json',
url : "../getCustomer",
...  
});

它正在进行编辑,但不请求

Route::get('/request', [ 
'middleware' => 'roles',
'roles' => [ 
'Requestor' 
],   
function(){return View('layouts.request');}
]);
/*Edit request*/
Route::get('/edit/{id}',array('as'=>'edit','middleware' => 'checksession',
function($id){
$data['id'] =$id;
return View::make('layouts.request',$data);
})
);

请求中的页面重定向到http://localhost/asset/getCustomer但我需要重定向为http://localhost/asset/public/getCustomer如何编写用于重定向的htaccess。我试过做

RewriteEngine On
RewriteRule ^$ /public [L] 

但没有运气

根据Route 更改AJAX请求中的url

$.ajax({
type: "POST",
dataType: 'json',
url : "/request",
...  
});

还将web.php 中Route的方法从"get"更改为"post">

Route::post('/request', [ 
'middleware' => 'roles',
'roles' => [ 
'Requestor' 
],   
function(){return View('layouts.request');}
]);

AJAX请求成功后重定向页面。

success: function (response) {
windoe.location.href = "/your-next-page";
},

,希望它对你有用

最新更新