Php Laravel vuejs:ajax后期路由错误
我已经使用axios和vue库实现了一个post ajax请求,当我在开发模式(idPhp Laravel vuejs:ajax后期路由错误,php,http,laravel-5,vuejs2,axios,Php,Http,Laravel 5,Vuejs2,Axios,我已经使用axios和vue库实现了一个post ajax请求,当我在开发模式(idlocalhost:8000)下运行时,一切正常 但当我从公用文件夹(即localhost/vutest/public)运行时,我的帖子url无法按预期工作 这是邮局的路线 Route::post('/test','HomeController@testPost'); JS axios.post('/test',this.user) .then(response =>
localhost:8000
)下运行时,一切正常
但当我从公用文件夹(即localhost/vutest/public
)运行时,我的帖子url无法按预期工作
这是邮局的路线
Route::post('/test','HomeController@testPost');
JS
axios.post('/test',this.user)
.then(response => {
console.log(JSON.stringify(response.data));
this.error=response.data.errors;
})
.catch(function (error) {
});
当我从localhost:8000
但是从localhost/vuetest/public
ajaxpost-url运行应用程序不起作用
当我检查开发人员控制台的标题信息时
Request URL:http://localhost/test
Request Method:POST
Status Code:301 Moved Permanently
Remote Address:127.0.0.1:80
什么问题
更新
当我将
\test
替换为http://localhost/vuetest/public/test
它的工作原理。很抱歉,这很让人困惑,您面临的问题与vue router或laravel或您的备份API有关?它与后端API有关。