FormCollection $('#Form').serialize()

  • 1079
  • 0

FormCollection   $('#Form').serialize()

1.front code

 function saveValue() 
{
 .ajax({
     url:"../Home/Action",     //"@Url.Action("action","Controller")
     type:"POST",
     ajax:false,
     data: $( "form" ).serialize(),
     success:function(data){
      //...
      },
      error:function(e){
      //...
      }
    });  
}

2.back code

 public ActionResult Index( FormCollection collect)
        {
          // use collect["name"]/collect[index] get value
          //...

          return ();
        }

 

參考網址: mrkt