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

159
Vistas
Vue axios call is claiming argument is null when should be an array

In my vue component I have a data array

data: {
  categories: [{id:1, title: "category 1"},{id:2, title: "category 2"}]
}

and I'm trying to load this in as a data argument in an axios call

axios({
  method: 'get',
  url: //testURL,
  data: {
    categoryCall: this.categories
  }
}).then(function (response){
  console.log(response);
}).catch(function (error){
  console.log(error.response);
});

but I'm getting a 400 bad request code where it tells me that argument 1 should be an array and null is given.

Am I not properly passing in the already established array in the axios call? Where am I going wrong?

var vm = 
new Vue({
  el: "#app",
  data: {
    categories: [
    {id:1, title: "category 1"},
    {id:2, title: "category 2"}
    ]
  },
  methods: {
    submit_axios(){
    
        axios({
            method: 'get',
            url: //test,
            data: {
              categories: this.categories
            }

        }).then(function (response) {
            console.log(response);

        }).catch(function (error) {
            console.log(error.response);
        });
    }
  }
  
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
   <button  @click="submit_axios()">Search</button>
</div>

about 4 years ago · Juan Pablo Isaza
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