ajax2 ASP.NET MVC : Ajax로 리스트 오브젝트를 Controller로 전달하기 Ajax로 리스트 오브젝트를 Controller로 전달하기 JS var things = [ { id: 1, color: 'yellow' }, { id: 2, color: 'blue' }, { id: 3, color: 'red' } ]; $.post('@Url.Action("PassThings")', { things: things }, function () { $('#result').html('"PassThings()" successfully called.'); }); Controller [HttpPost] public void PassThings(IEnumerable things) { // do stuff with things here... } 2019. 1. 24. Ajax처리를 포함한 return false에서 골탕먹은 일 내가 하고 싶었던 것 submit 버튼을 누르면 어떤 조건일 경우에 ajax처리를 하고 나서(여기선 밸리데이션 처리) 결과에 따라 return false;로 submit처리를 중단시키고 싶었습니다. NG 그래서 처음엔 아래와 같은 코드를 썼지만 이 코드는 return false;가 안먹고 그대로 submit 처리가 되어 버렸습니다… 음?;; $('button[type=submit]').click(function () { if ($('#value').length > 0) { $.ajax({ url: '/CheckValue', type: 'POST', async: false, traditional: true, data: { value: $('#value').val() }, success: function (.. 2019. 1. 23. 이전 1 다음