Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!