0

I want to pass object array(in JS) to server side/ backend. Help me.

I have to read record of multiple person from the user in my web page. To mange record, i created a class Person { name, address}. And a array of Person objects, each object have different person's name and address. Now at the end i want to send this object array to server side to save data in database. So how can i ??? Note: i can't use form submission way, because i have multiple Person's records. My project: https://code.sololearn.com/WlJ2gup2mial/?ref=app

27th Sep 2020, 11:43 AM
Bharat😃
Bharat😃 - avatar
1 Antwort
+ 2
You can send it as JSON object. You can not use HTML <form> for this. You need ajax request. Change the Content-Type of the request to application/json and POST the entire array to the backend in a single request. fetch('/backend/endpoint/url', { headers: { 'Content-Type': 'application/json', }, body: entryList, });
27th Sep 2020, 2:51 PM
Ore
Ore - avatar