난 숨겨진 필드 asp.net MVC JQuery와 게시 여러 숨겨진 필드는
<input type="hidden" value="1" id="serviceslist" name="serviceslist" />
<input type="hidden" value="2" id="serviceslist" name="serviceslist" />
<input type="hidden" value="3" id="serviceslist" name="serviceslist" />
내가 클릭 더 버튼을 추가해야
의 목록을 가지고 MVC 컨트롤러에 serviceslist을 전송하고자합니다. 기본적으로 배열로 목록을 보낼 필요가 있다고 생각합니다. 내가 어떻게 해?$('#addmoreservices').click(function() {
var serviceslist= $("#serviceslist").val()
$.ajax({
url: url,
data: { serviceslist: serviceslist },
cache: false,
dataType: "json",
traditional: true,
type: "POST",
success: function (data) {
alert("dddd");
},
error: function (reponse) {
alert("error : " + reponse);
}
});
});
이이 같은 시도 내 MVC 컨트롤러
[HttpPost]
public ActionResult AddmoreServices(List<int> serviceslist)
{
return View();
}
'id'가 고유해야합니다 –