vue axios發送formData數據格式的設置

                    this.$ajax({
                        method: 'post',
                        headers:{
                            'Content-Type': 'application/x-www-form-urlencoded'
                        },
                        transformRequest: [function (data) {
                            data = Qs.stringify(data);
                            return data;
                        }],
                        url: '-----------',
                        data: {
                            name: this.nameText,
                            industry: '來自mobile端的試用申請',
                            email: this.mailText,
                            tel: this.phoneText,
                            companyName: this.companyText
                        }
                    }).then(res => { }).catch(err => { })

發送時格式如下,沒有{}包裹

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章