ajax,request,serialize,list,,to,json,get,deserialized,list,send,array

Kubilay 7/27/2016 0

This code will let you serialize string list and get it from code behid

JavaScript
 var paramArray = [];
 $( ".ul li").each(function (index) {
      var value= $( ".span[data-id='"   id   "']" ).text();
      paramArray .push(value);
 });
 

$.ajax({ type: 'Post', cache: false, url: '/Home/List', data: { myArray: JSON.stringify(paramArray)}, dataType: "json", async: false, success: function (data) { console.debug(data); }, error: function (data) { console.debug(data); } });

C#

[HttpPost]
public string List()
{
      List<string> myList= (List<string >)JsonConvert .DeserializeObject(Request["myArray"], typeof(List <string >));
}

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments