title: json ajax complex type pass to MVC2 action
body: <p>I know this has been asked before in a similar form, but I have hit a bit of problem here....
  I have this classic problem of trying to pass a json complex type to MVC2.
  The problem (refer to the code below): I can pass the value "subincidentID" to the controller but the values "CodeType", "MOCode" and "SubCode" are all NULL.
  I HAVE installed the MVC2 future and registered "Microsoft.Web.MVC" in global.asax.cs and declare the JsonValueProviderFactory.</p>
  
  <p>The JQuery bit:</p>
  
  <pre><code>$('#btnDone').click(function() {
          var entity = {};
          var dbCode = new Array();
          dbCode[0] = { CodeType: "1", MoCode: "13", SubCode: "12" };
          entity = { subincidentID: "1", codeData: dbCode };      
              $.ajax({
                  type: 'POST',
                  data: entity,
                  dataType: 'json',
                  async: false,
                  url: "/controller/SaveMOData",
                  success: function(result) {
                      alert('success!');
                  }
              }); //end of post
          });   //end of btnDone click function
  </code></pre>
  
  <p>Controller in MVC:  </p>
  
  <pre><code>[HttpPost]
          public JsonResult SaveMOData(MOSubMitModel mo)
          {
              if (ModelState.IsValid)
              {
  
              }
              return Json(new { success = "true" });
          }
  </code></pre>
  
  <p>Model class in MVC (2):</p>
  
  <pre><code>public class MOSubMitModel
      {
          public int subIncidentID { get; set; }
          public List&lt;dbCode&gt; codeData { get; set; }
      }
  
      public class dbCode
      {
          public string CodeType { get; set; }
          public string subCode { get; set; }
          public string MoCode { get; set; }
      }
  </code></pre>
  
  <p>Have I missed something here?
  Do I have to declare any namespace on the controller page?
  I am sure it is a small problem but I have been scratching my head the whole day about it....:-(..</p>
  
  <p>Thanks in advance.
  W. Lam</p>