I want to pass selected index of dropdownlist in View to a different controller. I use java script for getting index of dropdaownlist. I got the Index.
But I want to pass that index to another Controller on click of my button .
How can I do that ?
here is my Java script snnipet
  $('#btnsubmit').click(function () {
        var deviceid = $('#ddldevice option:selected').val();
        $.ajax({
            type: 'GET',
            data: { deviceid: deviceid },
            url: '@Url.Action("ViewSensorTable","Home")',
            success: function (result) {
            }
        });
My Button Code
 <input type="submit" id="btnsubmit" value="Next" class="btn btn-primary btn-sm" />
And here is the Controller where i want the index value
 public ActionResult ViewSensorTable(int id)
 {
     return View();
 }
Edited
$('#btnsubmit').click(function () {
    var deviceid = $('#ddldevice option:selected').val();
    $.ajax({
        type: 'GET',
        data: { id: deviceid },
        url: '@Url.Action("ViewSensorTable","Home")',
        success: function (result) {
        }
    });
 
     
    