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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -