Can jQuery do a POST of a ViewModel to a Controller in ASP.NET MVC?

后端 未结 2 853
时光说笑
时光说笑 2020-12-31 15:45

I have my Html Textboxes created so that they will be bound to a custom view model when posting back to the server.

<%= Html.TextBox(\"CustomerFormViewMod         


        
2条回答
  •  [愿得一人]
    2020-12-31 16:24

    If I understand you right, I think it's pretty simple

    var formData = $("#form").serialize();
    
    $.post("path/to/action", formData, function(data) { //success } );
    

提交回复
热议问题