[HttpPost]
public JsonResult SaveList(List<LigarPagoModel> values)
{
return Json(new { Result = String.Format("Ejemplo indice 0: '{0}'", values[0]) });
}
And this is my model
public class LigarPagoModel
{
public string A { get; set; }
public string B { get; set; }
public string C { get; set; }
public string D { get; set; }
public string E { get; set; }
}
I need to create a string out of this values from the array I pull from the view I posted at the beggining for example if there's n ammount of elements in tabledata[] for example 2 elements I need to create a string that looks like this
I am not very clear from your description. Are you trying to make a query string with each element of tableData[]? If so, I think you can just splice the string with the element value.
for (i = 0; i < tableData.length; i++) {
total[i] = "&num" + i + "=" + tableData[i].A +
"&mon" + i + "=" + tableData[i].B +
"&doc" + i + "=" + tableData[i].C +
"&type" + i + "=" + tableData[i].D +
"&val" + i + "=" + tableData[i].E
}
Best Regards,
Jiadong Meng
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com
Thanks a lot jiadongm this helped me to create the string I was going to create in my model, so instead of doing it over there, I'd rather create the string using javascript and post it as normal string, solved my issue thanks!
Member
3 Points
9 Posts
How to create string out of this ajax post?
Nov 19, 2019 11:51 PM|napalm911|LINK
Hello everyone I currently have this scenario.
This is my controller
And this is my model
I need to create a string out of this values from the array I pull from the view I posted at the beggining for example if there's n ammount of elements in tabledata[] for example 2 elements I need to create a string that looks like this
Where
And
Used that structure because of the output of the html example
Member
440 Points
163 Posts
Re: How to create string out of this ajax post?
Nov 20, 2019 06:13 AM|jiadongm|LINK
Hi napalm911,
I am not very clear from your description. Are you trying to make a query string with each element of tableData[]? If so, I think you can just splice the string with the element value.
Best Regards,
Jiadong Meng
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com
Member
3 Points
9 Posts
Re: How to create string out of this ajax post?
Nov 20, 2019 03:45 PM|napalm911|LINK
Thanks a lot jiadongm this helped me to create the string I was going to create in my model, so instead of doing it over there, I'd rather create the string using javascript and post it as normal string, solved my issue thanks!