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

111
Vistas
How to set the multiple same name query in javascript ajax

I have python api which can get the multiple data in same query such as.

createdata?ob=120&st=cool&st=warm

It can get st as ["cool","warm"] in python.

st = request.query_params.getlist("st")

print(st) #["cool","warm"] get the data as array.

Now I want to do the same thing from ajax

I try this

$.ajax({
      type: "POST",
      url: "defapp/createdata",
      method: "GET",
      data: {"ob":130,"st":"warm","st":"cool"},
      contentType: "application/json",

and this.

$.ajax({
      type: "POST",
      url: "defapp/createdata",
      method: "GET",
      data: {"ob":130,"st":["warm","cool"]},
      contentType: "application/json",

However former one get ["cool"] as st

later one get [] as st.

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

0

It's don't work,because you api not recive a data body,but it recive a params value. You can changed to these below.

$.ajax({
      type: "POST",
      url: "defapp/createdata?ob=120&st=cool&st=warm",
      method: "GET",
      data: {},
      contentType: "application/json",

I hope is can work in your case.

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