title: Posting array of JSON objects to MVC3 action method via jQuery ajax
body: <p>Does the model binder not suport arrays of JSON objects? The code below works when sending a single JSON domain object as part of the ajax post. However, when sending an array of JSON domain objects, the action parameter is null.</p>
  
  <pre><code>     var domains = [{
                          DomainName: 'testt1',
                          Price: '19.99',
                          Available: true
                      }, {
                          DomainName: 'testt2',
                          Price: '15.99',
                          Available: false
                      }];
  
                  $.ajax({
                      type: 'POST',
                      url: Url.BasketAddDomain,
                      dataType: "json",
                      data: domains,
                      success: function (basketHtml) {
  
                      },
                      error: function (a, b, c) {
                          alert('A problem ocurred');
                      }
              });
  </code></pre>
  
  <p>This is the action method:</p>
  
  <pre><code>public ActionResult AddDomain(IEnumerable&lt;DomainBasketItemModel&gt; domain)
  {
      ...
  </code></pre>
  
  <p>Any ideas if it is possible to do this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>@Milimetric</p>
  
  <p>Your solution works! However, this is my fault, but the code I demonstrated isn't the real code of my problem, I was trying to show equivalent code that is easier to understand.</p>
  
  <p>I am actually creating an array, then interating some DOM elements and pushing a JSON object onto the array, then posting this array as the data...</p>
  
  <pre><code>var domains = [];
  
                  $(this).parents('table').find('input:checked').each(function () {
                      var domain = {
                          DomainName: $(this).parent().parent().find('.name').html(),
                          Price: $(this).parent().parent().find('.price span').html(),
                          Available: $(this).parent().parent().find('.available').html() == "Available"
                      }
  
                      domains.push(domain);
                  });
  
                  $.ajax({
                      type: 'POST',
                      url: Url.BasketAddDomain,
                      dataType: "json",
                      data: { domain: domains },
                      success: function (basketHtml) {
  
                      },
                      error: function (a, b, c) {
                          alert('A problem ocurred');
                      }
                  });
  </code></pre>