0

In my VueJS application, I have a form to submit some data

Admin can fill the same data for aother system user as well.

When an admin fill these data for a different user, I need to store that user's user id in the DB.

I'm fetching that user id from the URL.

But I'm struggling to pass that user's user id with the rest of the form data.

How can I pass that user id with the rest of the data to my laravel

This is how I fetch the user id and store it

var url = window.location.href;
var url_split = url.split("/");
var my_id_location = url_split.length - 2;
var my_id = url_split[my_id_location];

This is how I pass my form data

            const formData = new FormData()
            formData.append('match_id', this.matchId)
            formData.append('ground', this.ground)
            formData.append('played_at', moment(this.dateOfStart).format('DD-MM-YYYY'))
            formData.append('ended_at', moment(this.endedDate).format('DD-MM-YYYY'))

Since my_id is not a form data, how can I pass that value ?

1
  • What did happen when you append my_id to formData? Commented Apr 5, 2022 at 5:03

1 Answer 1

1

It's same what you did with form data. Add like this

formData.append('my_id', my_id)
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.