0

I have this array:

[{"ID":"1","Shasi":"VF157469762","Brand":"82","Model":"CLIO IV Societe Life","Nomer":"C3KK","Insurence":"\u0417\u0410\u0414 \u0410410 \u0418\u041d\u0428\u0423\u0420\u042a\u041d\u0421 \u0413\u0420\u0423\u041f \u0410\u0414","Grajdanska":"\u0417\u0410\u0414 \u0411\u0423\u041b\u0421\u0422\u0420\u0410\u0414 \u0412\u0418\u0415\u041d\u0410 \u0418\u041d\u0428\u0423\u0420\u042a\u041d\u0421 \u0413\u0420\u0423\u041f \u0410\u0414","Given":"0000-00-00","ContractN":"0040000434","ContractType":"ZMV","CustomerN":"1100024801","CustomerName":"\u041d\u0415\u0421\u0422\0413\u0410\u0420\u0418\u042f \u0410\u0414","Vat":"8349","OwnerN":"","OwnerName":"","OwnerVAT":"","ContractDate":"2021-02-28","GTP":"2019-04-30","NextTO":"2020-04-19","TON":"98015","GO":"2019-04-27","Kasko":"2021-04-28","Vinetka":"2019-01-31","Total":"2490"},{"ID":"2","Shasi":"VF16RB9763","Brand":"82","Model":"CLIO IV Societe Life","Nomer":"C16KM","Insurence":"\u0417\u0410\u0414 \u0411\u0423\u041b\u0421\u0422\u0420\u0410\u0414 \u0412\u0418\u0415\u041d\u0410 \u0418\u041d\u0428\u0423\u0420\u042a\u041d\u0421 \u0413\u0420\u0423\u041f \u0410\u0414","Grajdanska":"\u0417\u0410\u0414 \u0411\u0423\u041b\u0421\u0422\u0420\u0410\u0414 \u0412\u0418\u0415\u041d\u0410 \u0418\u041d\u0428\u0423\u0420\u042a\u041d\u0421 \u0413\u0420\u0423\u041f \u0410\u0414","Given":"0000-00-00","ContractN":"00434","ContractType":"ZMV","CustomerN":"1101","CustomerName":"\u041d\u04041b\u0415 \u0411\u042a\u041b\u0042f \u0410\u0414","Vat":"8349","OwnerN":"","OwnerName":"","OwnerVAT":"","ContractDate":"2021-02-28","GTP":"2019-05-03","NextTO":"2019-02-02","TON":"5969","GO":"2020-05-11","Kasko":"2021-05-12","Vinetka":"2019-01-31"}]

I want to be able to put it inside input value like this:

<form action="exportToExcel.php" method="post">
    <input type="hidden" name="data" v-model="cars">
    <input type="submit" class="btn btn-primary" name="submit" value="Ек�?портирай към Excel">
</form>

But what I end-up getting is this:

<input type="hidden" name="data" value="[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]">

What I am doing wrong? I tried with :value, but I am getting the same result. Thanks!

1
  • @mathk answer is correct. A little bit addition is if backend is PHP you can get your array as $data = json_decode(json_encode($_POST), true); . And there will be your array of data to create file. Commented May 10, 2019 at 7:22

1 Answer 1

3

I guess you are looking for :value=JSON.stringify(cars).

Though it looks very old school to rely on form this days. I advise to use lib like axios for submitting form data and remove the need of an hidden input

Sign up to request clarification or add additional context in comments.

1 Comment

thanks for your answer. the thing is that i need to send the data to other php page where i want to transform the data and create an xml file, im not use if i can do this only using axios...

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.