Rafaela, I did an example in ASP.NET CORE.
In your code the URL does not match the Controller you entered.
An important point is to correctly define the arrays in Javascript and inform the following parameter in jQuery: Traditional = true. According to the jQuery documentation, if set to true, it enables standard encoding. Some frameworks "don’t understand standard encoding".
Example:
Traditional = false (Default behavior)
a%5Bone%5D=1&a%5Btwo%5D=2&a%5Bthree%5D=3&b%5B%5D=1&b%5B%5D=2&b%5B%5D=3
Traditional = true
a[one]=1&a[two]=2&a[three]=3&b[]=1&b[]=2&b[]=3
Code below...
[HttpGet]
public ActionResult AtualizarTabelaDeRelatorioDeQuantitativoDePendencia(int[] arrayDeInstalacao = null,
int[] arrayDePendencias = null,
int? parametroDoNumeroDaPagina = null,
int? parametroDoTamanhoDaPagina = null)
{
return Json(arrayDeInstalacao);
}
<div class="row">
<button id="btnEnviar" class="btn btn-primary">Enviar</button>
@section Scripts{
<script>
$('#btnEnviar').on('click', function () {
var arrayDeInstalacaoForm = [100, 200, 300];
var arrayDePendenciasForm = [1, 2, 3];
var parametroDoNumeroDaPaginaForm = 90;
var parametroDoTamanhoDaPaginaForm = 50;
var request = $.ajax({
method: "GET",
url: '@Url.Action("AtualizarTabelaDeRelatorioDeQuantitativoDePendencia", "Home")', // Parâmetros - Action e Controller
contentType: "application/json; charset=utf-8",
cache: false,
traditional: true,
dataType: "json",
data: {
arrayDeInstalacao: arrayDeInstalacaoForm,
arrayDePendencias: arrayDePendenciasForm,
parametroDoNumeroDaPagina: parametroDoNumeroDaPaginaForm,
parametroDoTamanhoDaPagina: parametroDoTamanhoDaPaginaForm
}
});
//Se a requisição for feita com sucesso...
request.done(function (msg) {
alert(msg)
});
//Se houver falha na requisição
request.fail(function (jqXHR, textStatus) {
alert(textStatus)
});
})
</script>
}
but the names in the object
data
do not match the method signature, should bedata: {
 'arrayDeInstalacao': arrayDeInstalacao, .... etc
– Ricardo Pontual
fixed, but that’s not the problem, I had only changed when I created the post, the names in the project are the same...
– Rafaela Marraschi
Displays some error?
– Victor Carnaval
@Rafaelamarraschi See in the browser console which URL is being used in the request, it is probably wrong.
– Jéf Bueno