asp.net mvc - Pass multiple JSON objects to MVC5 action method -
i want pass parameters array , string don't send string parameter control action. use code:
public virtual async task<actionresult> create(addcategorymodel viewmodel, string id) {}
i use code json don't pass id
action:
<script> $(document).ready(function(){ $(".btn-success").click(function(e) { var formdata = json.stringify($("#ajaxform").serializearray()); alert(formdata); var myform = $("#ajaxform").serializejson(); console.log(myform); $.ajax( { url : "/category/create/", //,+ //$(foo).val(), //url: "url.action("category", "create", new { id = "oo" })", //id: $(foo).attr('value') , type: "post", data : {valarray:formdata,'id':'20'}, success:function(maindta) { alert(maindta); }, error: function(jqxhr, textstatus, errorthrown) { } }); e.preventdefault(); //stop default action }); }); </script>
Comments
Post a Comment