如何在mvc4中将javascript数组分配给模型数组? [英] How to assign javascript array to model array in mvc4?

查看:101
本文介绍了如何在mvc4中将javascript数组分配给模型数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个javascript数组,我想将它的所有值分配给MVC Model数组。



例如:



var selectedValues = [];

$ .each($('#ImageExtensionList选项:选中'),函数(索引,值){

selectedValues.push(value);



这里,@ Model.OptionList = selectedValues我想分配但不能正常工作。



任何人都可以分享这个吗?



谢谢。

解决方案

.each(


(' #ImageExtensionList选项:选中'),函数(索引,值){

selectedValues.push(value);



这里,@ Model .OptionList = selectedValues我想分配但不工作。



任何人都可以分享这个吗?



感谢。

Hi,

I have a javascript array and i want to assign all its value to MVC Model array.

For ex.

var selectedValues = [];
$.each($('#ImageExtensionList option:selected'), function (index, value) {
selectedValues.push(value);

here, @Model.OptionList = selectedValues i want to assign but not working.

Can anyone share on this?

Thanks.

解决方案

.each(


('#ImageExtensionList option:selected'), function (index, value) {
selectedValues.push(value);

here, @Model.OptionList = selectedValues i want to assign but not working.

Can anyone share on this?

Thanks.


这篇关于如何在mvc4中将javascript数组分配给模型数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆