In an asp.net mvc 4 web application I have a kendo grid (named ExternalUserList) where I have added a custom column with checkboxes in order to send an email to selected users. What I do is send the database id of the user(s) in json format to my mvc controller.
This is my javascript code:
<script type="text/javascript">
function sendMailToExternalUsers() {
var ids = [];
var proId;
var checkBox = $('#ExternalUsersList > table > tbody > tr td:nth-child(2) > input');
checkBox.each(function (index) {
var $input = $(this);
if ($input.is(':checked')) {
var count = index + 1;
proId = $('#ExternalUsersList > table > tbody > tr:nth-child(' + count + ') td:first-child');
ids.push(proId[0].innerText);
}
})
var postData = JSON.stringify(ids);
$.ajax({
type: "POST",
url: "/ExternalUser/SendEmailToExternalUsers/",
data: postData,
dataType: "json",
contentType: "application/json",
traditional: true
});
}
</script>
and here is my controller:
[HttpPost]
public EmptyResult SendEmailToExternalUsers(List<string> ids)
{
//Here i do some processing
}
All the above code works fine in Internet Explorer and Chrome but on Firefox it does not. In fact if i have selected for example 3 users from the kendo grid, visual studio debugger shows that ids List<string>
has 3 elements but values are empty. In IE and Chrome values are perfectly correct.
So is wrong with it?