How can we pass array type data from ajax to web API.
Web API -
public HttpResponseMessage SearchFileByIDs([FromBody]string[] values){
.....
....
...
}
Ajax call -
We get fruits id in web api parameter values -
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jenith ThakkarRank #789 · 2.9K reputationPosted Mar 18, 2019, 4:11 AM EDT
Suppose if you want to pass it in 0 and 1 then you need to do like below
let fruits=[];
fruits[0]=["5c86296afce2d453a8c27d1c"];
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 18, 2019, 4:36 AM EDT
Madan ShekarRank #428 · 5.9K reputationPosted Mar 18, 2019, 2:36 AM EDT