Why after I submit my form the value of status_tracking is never pass. The values of the other data is pass but not with the checkboxes. How can i get the correct checkbox cheked values pass to the ajax call? for example: status_tracking = 2,3
In view:
<input type="checkbox" name="status_tracking" id="status" value="1" />
<input type="checkbox" name="status_tracking" id="status" value="2" />
<input type="checkbox" name="status_tracking" id="status" value="3" />
<input type="checkbox" name="status_tracking" id="status" value="4" />
</td>
<td><button type="button" class="btn btn-primary" id="search">Search</button></td>
$('#search').click(function () {
var data;
var assignment = $("#selectAssignment").val();
var application = $("#selectApplication").val();
var assignedTo = $("#assignedToID").val();
var status_tracking = $('input[name=status_tracking]:checked').map(function (_, el) {
return $(el).val();
}).get();
// alert(status_tracking); //this get the correct value
$.ajax({
type: "GET",
datatype: 'html',
url: '',
data: { 'assignment': assignment, 'application': application, 'status_tracking': status_tracking, 'assignedTo': assignedTo },
});
});
});
in controller:
public ActionResult GetSearchData(string assignment, string application, string assigedTo, string status_tracking)
{
}