asp.net mvc - MVC - Sending List of Values to AJAX call -


I have a model that opens & amp; The user gives the option to check some checkboxes when the user checks the check box of their choice I want to send all the values ​​of the checkbox & amp; Call AJAX method.

I want to send the value of the selected checkbox to the controller method.

This is my code: -

  // These are dynamic checkboxes - this is just an example & lt; Input type = "checkbox" name = "name" value = "code" & gt; & Lt; Input type = "checkbox" name = "name" value = "code1" & gt; & Lt; Input type = "checkbox" name = "name" value = "code2" & gt; & Lt; Input type = "checkbox" name = "name" value = "code3" & gt; // onClick event button jq.get ('/ controller / gate data', function (data) {jq ('# placeholder'). Html (data);}); // Controller [HTPGet] Public Action Result Milladata () {partial view ("_popterchange"); }   

To get the values ​​of checked boxes and add them to an array < / P>

  var array = []; $ ('Input: Check'). Each (function () {array.push ($ (this) .val ());}   

and to pass the controller to

considers you to be the controller method

  gets public action (string [] value) {// returns some partial view based on values} < / Code>   

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -