jquery - Passing JavaScript array in View to Controller Razor -



jquery - Passing JavaScript array in View to Controller Razor -

i need pass array form view action, how that? i‘ve read several blogs & q&a, no luck. below code. need “selectedvals” in “createscorelinkfile”.

thanks in advance.

<script> $('#btngetfile').on('click', function () { var selectedvals = ["12","233","121","34","34"]; location.href = '@url.action("createscorelinkfile", "home"'; }); </script> public filestreamresult createscorelinkfile() { edmgredataio objpdmdataioforgadireports = new edmgredataio(); string scorelinkdata = objpdmdataioforgadireports.getscorelinkreport(104488, 3582527, 2, "10-jul-2009", "01-jul-2009", 1); var bytearray = encoding.ascii.getbytes(scorelinkdata); var stream = new memorystream(bytearray); string sfilename = "scorereport " + datetime.now.tostring("ddd dd mmmm yyyy hh:mm:ss tt") + ".txt"; homecoming file(stream, "text/plain", sfilename); }

i've done below on button click

var exportform = document.forms[0]; exportform.selectedvalue.value = selectedvals; exportform.target = "_blank"; exportform.action = '@url.action("createscorelinkfile", "home")'; exportform.submit();

jquery asp.net-mvc asp.net-mvc-4 razor

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -