I have a form which I need to add some variables to before sending it to the server which is python flask. I used the following code to send the form which works fine except when sending 2 dimensional array it will treat it as 1 dimensional in flask
javascript:
form = document.getElementById('calculator-form');
fdata = new FormData(form);
fdata.append('readings', plotData.readings);
$.ajax({
url: "some/url/",
type: 'POST',
data: fdata,
processData: false,
contentType: false,
});
so if plotData.readings=[[1,2,3],[4,5,6]]
I receive it in flask 1,2,3,4,5,6 and I don't always know the size of the array to reshape it from flask, is there a way to send so that the backend see it as 2 dimensional array?
fdata.append('readings', JSON.stringify(plotData.readings));for sending, then you'll have to decode JSON, I'm not familiar with Python, but I'm sure there is a simple way to do it, JSON is a very popular format.