Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- function Save() {
- $(document).ready(function () {
- var things = [
- { id: 1, color: 'yellow' },
- { id: 2, color: 'blue' },
- { id: 3, color: 'red' }
- ];
- things = JSON.stringify({ 'things': things });
- $.ajax({
- contentType: 'application/json; charset=utf-8',
- dataType: 'json',
- type: 'POST',
- url: '/PassThings',
- data: things,
- success: function () {
- alert("success");
- },
- failure: function (response) {
- alert(response);
- }
- });
- });
- }
- </script>
- <input type="button" value="Pass Things" onclick="JavaScript: Save();">
- public class Thing
- {
- public int Id { get; set; }
- public string Color { get; set; }
- }
- public void PassThings(List<Thing> things)
- {
- var t = things;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement