- 0
Transmit an array of strings in a POST operation using Jquery/AJAX
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Similar Content
-
Microsoft introduces TypeScript 5.4: Explore the latest features and enhancements
By zikalify,
- microsoft
- typescript
- (and 4 more)
- 11 replies
- 2 views
-
JavaScript All-in-One For Dummies (worth $24) free in exchange for your email
By News Staff,
- ebook offer
- javascript
- (and 3 more)
- 0 replies
- 3 views
-
JavaScript from Frontend to Backend ($20.99 Value) FREE for your work email
By News Staff,
- ebook offer
- sponsored
- (and 3 more)
- 0 replies
- 3 views
-
Firefox vs Chrome: Mozilla finally manages to trump Google on Windows in a decade old test 1 2
By hellowalkman,
- 33 replies
- 4 views
-
Someone got ChatGPT to run on Windows 98 and other older Windows versions by making JavaGPT
By John Callaham,
- 9 replies
- 5 views
-
Question
Shadrack
Hello! I would like to submit an array of strings from a web form to my web service and need a little bit of hand holding. My web service I've written seems fine with having an array of strings as input but I'm not exactly sure how to encode this in javascript from my html form elements before I ship the data to my web service to be processed. The array of strings will be pretty small (on the order of 20x3 strings).
I suspect that there is a clever way to do this by coding the form correctly and just running a jquery .serialize() operation on the form and submitting it.
My first thought was to define a number of textbox inputs and give them incremental ID#'s such as "array0_0", "array0_1", "array0_2", "array1_0", "array1_1", "array_1_2", "array_2_1" etc.
Then as a first step before submitting the post, collect all the values in the textboxs and compile an array using 2 nested for loops. Something like that would probably work, but I was wondering if there was some magic that I could do in my form so that jquery recognizes an array of strings in my form so that the .serialize() function just does its magic.
Thanks!
-Shad
Link to comment
Share on other sites
21 answers to this question
Recommended Posts