Vue-Resource Post Request:
this.$http.post(form.action, new FormData(form)).then(function (response) {
FetchResponse.fetch(this, response.data)
})
Request are Send as Content-Type:"application/json;charset=utf-8" But No data can be displayed by PHP Post.
Set Up Header Vue-Resource:
request.headers.set('Content-Type', '');
But Request Content-Type:", multipart/form-data; boundary=----WebKitFormBoundaryTsrUACAFB1wuhFOR"
there is a comma at the beginning of the query.
Jquery Post Request:
$.ajax({
url : form.action,
type : 'POST',
data : new FormData(form),
success : function (reqData) {
FetchResponse.fetch(ss, reqData)
},
});
The same query works seamlessly with jQuery. jQuery Content-Type: "multipart/form-data; boundary=----WebKitFormBoundaryTsrUACAFB1wuhFOR"
Issue: https://github.com/vuejs/vue-resource/issues/398
Please try instead to post a simple JSON object and enable the 'emulateJSON' vue-resource option:
const formData = {
someProp: this.someProp,
someValue: 'some value'
};
this.$http.post(this.postUrl, formData, {emulateJSON: true})
.then(response => {
console.log(response.body);
}, response => {
console.error(response.body);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With