Skip to content
Advertisement

How to add array to form when using jquery submit?

I have a form on a page and the data inputed gets posted to the server. I am right now tying to add an array to the post like so:

JavaScript

As written in the comment above I get

TankCalVerts=%5Bobject+Object%5D%2C%5Bobject+Object%5D

in the post

And in the action method:

enter image description here

How do I do this?

EDIT:

JavaScript

Advertisement

Answer

After some thinkering and some help from a brilliant friend we came up with this:

JavaScript

We took the serialized data and turned it in to an object which we then posted as a JSON.

I had done a solution where I built my own object but in thise case it would be up to 30 paramaters and i was trying to avoid it and with the simple loop above it solved that issue.

Full answer:

JavaScript

post json function:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement