为什么laravel vue js this.form.post(url)会自动转换为get方法
Vue.js get方法正在工作,而不是post方法。 但在localhost中,它工作得非常好。 仅当我将项目上载到服务器时才面临此问题为什么laravel vue js this.form.post(url)会自动转换为get方法,laravel,vue.js,Laravel,Vue.js,Vue.js get方法正在工作,而不是post方法。 但在localhost中,它工作得非常好。 仅当我将项目上载到服务器时才面临此问题 export default { data(){ return { form: new Form({ company_name : '', address : '', contact_name : '',
export default {
data(){
return {
form: new Form({
company_name : '',
address : '',
contact_name : '',
number : '',
keyword_or_comment : '',
attachment : ''
})
}
},
methods: {
createPhoneBook(){
this.$Progress.start();
const url = `${API_URL}/api/apiurl/`;
this.form.post(url)
.then(() => {
toast.fire({
type: 'success',
title: 'Phone book added successfully'
})
this.$Progress.finish();
})
.catch(() => {
this.$Progress.fail()
})
}
},
created() {
}
}
任何人都可以帮助我,
提前感谢。我建议您使用axios Ajax请求。强烈建议vue js使用此选项 比如:
请你能显示你的代码吗?现在我还粘贴了我的代码,请检查你的网络面板-我敢打赌你得到的是301/302重定向。也许是HTTPS重定向?谢谢你的回复。我把它修好了。问题在我的url中,我的url末尾有一个“/”。当我删除它后,post方法正在工作。。。
axios.post(location.pathname, { body: this.body })
.catch(error => {
flash(error.response.data, "danger");
})
.then(({ data }) => {
this.body = "";
});