首页 > Web开发 > 详细

ASP.NET MVC从视图传递多个模型到Controller

时间:2016-01-22 17:49:13      阅读:241      评论:0      收藏:0      [点我收藏+]
$(function() {
        $("#go").click(function() {
            var models = [];
            $.each($("table tr"), function(i, item) {
                var ProductName = $(item).find("[name=ProductName]").val();
                var SupplierID = $(item).find("[name=SupplierID]").val();
                var CategoryID = $(item).find("[name=CategoryID]").val();
                models.push({ ProductName: ProductName, SupplierID: SupplierID, CategoryID: CategoryID });
            });
 
            $.ajax({
                url: ‘../../Home/ReceiveData‘,
                data: JSON.stringify(models),
                type: ‘POST‘,
                contentType: ‘application/json; charset=utf-8‘,
                success: function(msg) {
                    alert(msg);
                }
            });
        });
    })
</script>

ASP.NET MVC从视图传递多个模型到Controller

原文:http://www.cnblogs.com/Jerrycjc/p/5151446.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!