简体   繁体   中英

Send Multiple Data to Controller by using Javascript json

You will see items below side.I want to use items in my "Data".

Something like this.

MyItemList : items

How can i use items in data ?

var items = checkListBox3.GetSelectedItems();
alert(Array.prototype.map.call(items, function (item) {
return  item.value;
}).join(", "));

var data= {
Something: Something.GetValue(),
//My question here (I want to use above items here like MyList:items)
};

$.ajax({
url: "/Home/MyUrl",
type: "POST",
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(veri),

I would suggest trying exactly what the comment in your code said, and use MyList:items :

var data= {
   Something : Something.GetValue(),
   MyList : items
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM