php - Vue Resource Post Request Content-Type


Vue-Resource Post Request:

this.$, new FormData(form)).then(function (response) {

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:

    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"





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.$, formData, {emulateJSON: true})
   .then(response => {
    }, response => {

People are also looking for solutions to the problem: php - 'NotNullConstraintViolationException' Error when flush() on Symfony 3


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.