这是我的代码,用于将gridview中的所有项目推送到数组
var arrInputSparepart = [];
$("#Gridview1").find(".InputSparepart").each(function () {
arrInputSparepart.push($(this).text());
});
var explodedInputSparepart = $.map(arrInputSparepart, function (InputSparepartName, InputSparepartIndex) {
return ([InputSparepartName]);
});
alert(explodedInputSparepart); //this is return list = **string1,string2** etc in display alert
我怎么能把那个数组放到json ??
$.ajax({
type: 'POST',
url: 'http://mydomain/api/TestApi/TestMethod',
**data: JSON.stringify(????????), //what else here??**
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(data){ console.log(data) }});