can we get the multiple values from a select tag through Ajax script in controller in asp.net MVC?
I Have tried for Single Value that I have done by .val Function..
But not for Multiple Values
Any suggestion Please Help
can we get the multiple values from a select tag through Ajax script in controller in asp.net MVC?
I Have tried for Single Value that I have done by .val Function..
But not for Multiple Values
Any suggestion Please Help
Yes you can create multi-select like this:
<select multiple="multiple" name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
And your controller's action should look like something this:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(string[] cars)
{
// ....
return View();
}
The ajax post codecan be the same as in your previous case.