I have a 2d array in javascript which I have to send to sinatra and store using datamapper,
I’ve been trying to put them in forms, but its a bit difficult to do it with forms, can I send an array to sinatra and process it?
I have a 2d array in javascript which I have to send to sinatra
Share
You can send it to Sinatra encoding the content as a JSON string and passing it using the body part of a POST request.
Here’s how the string should look like.
Send the content to Sinatra (using
curlor any other HTTP library)Then instruct Sinatra to handle the path
Note. I haven’t tried the code actually, so you might need small changes to make it working. This is just a prototype.