Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
ASP .Net Core Call Controller Function from Javascript with redirect from Controller

I am breaking my head on this and cant find a solution. In short I have a ASP .Net Core MVC page that has a Javascript list. I need to pass that list to a redirect. I have this in place and it is working so not the solution I am looking for as it is not secure.

So what I am trying to do is calling the Controller function from Javascript passing the list. I can only do this with Ajax but the controller wont redirect on an Ajax call. Is there anyone that has encountered a similar problem and possibly a solution for this?

Javascript var -> Controller -> redirect.

Thank you in advance guys

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I found the solution. So leaving the answer here for any future guys having the same problem.

Javascript

    $("#btn").click(function () {
       var PostData = ["1","2","3","4","5","6","7","8","9"]
       if (PostData != "") {            
          window.location.href ="Controller/Function?test=" + PostData
                   
       } else
         alert('Oops.!!');});

C# Controller

 public IActionResult Test(string test)
    {
        return RedirectToAction("function", "Controller", new { test });
    }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda