0

Here is the property in the model :

[Required]
[Display(Name="Qualifications")]
public List<string> Qualifications { get; set; }  

And here is the JS code

  var data = {
  UserName : $("#name").val(),
  Qualifications: $("input[name='Qualifications']").map(
  function()
  {
    return $(this).val();}).get()
  }
    if(condition)
  {
   alert(JSON.stringify(data));
  $.ajax({
  url :"ActionMethodName",
  type:"POST",
  datatype:"json",
  data:data,
  success:function() 
  {any code}
  })}  

The action method

[HttpPost]  
public ActonResult Register(RegisterationModels mode)  
{
   LoginRegisterationManager manager = new LoginRegisterationManager();
    int ret =  manager.Register(model.UserName, model.Password, model.DatOfBirth, model.SSN, model.Qualifications);
            if (ret != 0)
            {
                return Json(new { success = true });
            }
            else 
            {
                return Json(new { success = false});
            }

}

I can not find the prop, alerting [data] shows me that the JSON object is well formed, and the model parameter in the action methods maps all the props except for the list??

Logging the JSON object outputted: {"UserName":"omAhmed","Password":"223311","DatOfBirth":"02-02-1998","SSN":"55446‌​677443388","Qualifications":["lkjhhu","'ljbv","lohvb"]}

0 Answers0