0

If i send and image only i can access it, but problem is that i need to send some titles, sub titles and text.

My form tag:

<form @submit.prevent="handleFormSubmit" method="POST" enctype="multipart/form-data">

My blog data looks like this:

   blog:{
                postTitle: '',
                sectionTitles:[
                    {
                        sectionTId: 0,
                        title: ''   ,
                        belongsTo: '' 
                    },
                    
                ],
                images: [
                    {
                        // imageId: 0,
                        // belongsTo:''
                    }

                ],
                textareas: [
                    {
                        textareaId:0,
                        text: '',
                        belongsTo:''
                    },

                ]

            },

here is my submit:

async handleFormSubmit(){
    let data = new FormData();
    data.append('blog',this.blog)
    await this.setCreatePost(data)
},

At Laravel I just return request:

return $request['blog'];

And I get:

data: "[object Object]"
2
  • 1
    data.append('blog',JSON.stringify(this.blog)) Commented Dec 9, 2021 at 14:24
  • can you answer so i can fill the answer plz, and thanks, that works. Commented Dec 9, 2021 at 14:43

1 Answer 1

1
data.append('blog',JSON.stringify(this.blog))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.