Skip to content Skip to sidebar Skip to footer

Passing An Array Of Javascript Classes To A Mvc Controller?

I am trying to pass an array of services to my controller. I've tried a bunch of different ways to get it work, serializing the data before going to controller, serializing each se

Solution 1:

Set the content-type and use POST instead of GET (as it is a list of complex type objects). mark your action with HttpPost attribute too.

See if this works:-

 $.ajax({
           type: "POST",
           url: actionurl,
           data: JSON.stringify(da),
           dataType: "json",
           contentType: 'application/json',
           async: true,
           success: function (d) {
               if (typeof (done) == 'function') {
                   var str = JSON.stringify(d);
                   done(JSON.parse(str));
               }
           }
       });

Post a Comment for "Passing An Array Of Javascript Classes To A Mvc Controller?"