Execute Axios GET request by transmitting object values rather than the object itself

Encountering an unusual issue here. Currently, utilizing Axios for a GET request. In order to send multiple values in the params object, I include an object named dataObject. Surprisingly, when I just send the object itself, the response received is incorrect. However, manually typing key-value pairs from the object results in a correct response. Thus, aiming for my sent params to resemble this format:

https://i.sstatic.net/b250I.png

Nevertheless, when only sending the object, it appears as follows: https://i.sstatic.net/J8MNL.png

Hence, speculation arises regarding potentially extracting individual key-value pairs from the object through some sort of operation, which remains elusive at the moment.

Below showcases the two different Axios versions utilized:

return axios.get(GET_ENDPOINT, {
    params: {
      dataObject

return axios.get(GET_ENDPOINT, {
    params: {
      //dataObject
      20090519001:'',
      iid:1444430872256,
      accessoryIdString:'',
      mode:'addToCart',
      quantity:1,

Answer №1

It looks like you are passing the params as a nested object within the params object:

params: { dataObject: { etc } }

However, axios requires a flat object structure, so what you should use is

params: dataObject

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The slider on my iPad and Kindle Fire in Linux mode is not functioning properly

Having an issue on my e-commerce platform, Bence Tupperware, which is built with MVC.Net. The problem seems to be related to the slider at the top of the page. After checking in Mozilla's responsive design mode, everything appears to work fine on devi ...

Learn how to dynamically change a class name with JavaScript to alter the color of a navbar icon

I have little experience with javascript, but I want to make a change to my navbar icon. Currently, my navbar has a black background with a white navbar icon. As I scroll the page, the navbar background changes to white and the font color changes to black. ...

Is there a way to determine in FireBug the specific JavaScript code being received from the server following an Ajax request?

Within my HTML code, I am transmitting a dollar amount to the server in order to convert its currency within the application. Is there a way for me to use FireBug to track and view the JavaScript that is being received from the server following this Ajax ...

Calculating the sha1 hash of large files using JavaScript in the browser without causing excessive memory usage

Is there a method to calculate the hash of large files in JavaScript without needing to load the entire file in a FileReader? Specifically, I'm interested in finding out if it's possible to stream a file and calculate its sha1 hash in JavaScript. ...

Uploading to a designated folder using Google Script

Looking to create a form for uploading files, photos, and videos to specific folders in Google Drive using Google Apps Script. However, encountering an error "invalid argument listener". Here is the HTML index: <!DOCTYPE html> <html> &l ...

Having trouble retrieving the toDataURL data from a dynamically loaded image source on the canvas

Currently, I am working on a project that involves a ul containing li elements with images sourced locally from the "/images" folder in the main directory. <section class="main"> <ul id="st-stack" class="st-stack-raw"> ...

Click event recursion occurs due to the use of $.post

I have a collection of product rows available for customers to select from. Each row is designated with the class "product-line". Upon clicking on a row, I aim to visually indicate its selection status by toggling the "product-checked" class, and subsequen ...

Utilizing Loopback Callbacks within a Looping Structure

While working in a for-loop, I encountered an issue where I needed to access the loop variable 'i' from within a callback function but it was not accessible due to closure restrictions. Despite attempting different methods such as using (i) or ca ...

"Handling Errors in JavaScript when a Button Click Event Triggers a

There are 2 buttons intended for "Add to Favorites" and "Remove from Other Favorites". Here is the code snippet: <button type="submit" class="btn btn-warning btn-xs" id="FavoriButonex" data-id="<?php echo $sorid ?>"> <i class="fa fa-hea ...

Using Typescript to create an asynchronous function without explicitly declaring a Promise

When you examine TypeScript's async function, you may notice the redundancy with "async" and "Promise<type>". public async test(): Promise<string> { return "Test"; } Is there a way to configure TypeScript to handle async types ...

React.js is throwing an error due to an unexpected character '⇒'

This is my first time working with React.js and I'm experimenting with some code. I am really enjoying it, but there's one syntax error that keeps tripping me up: {this.state.data.map((person, i) ⇒ )}. An online tutorial said this should work, ...

What sets apart `ng-if` from `data-ng-if`?

Can you explain the distinction between ng-if and data-ng-if? Although they appear to function similarly, I'm struggling to discern the specific difference as there isn't much information out there on data-ng-if. ...

Node.js and EJS are throwing an error, indicating that the file.ejs is unable to identify the variable definitions

I am facing an issue with my express.js server template. A 'x is not defined' error keeps popping up, but I can't seem to find where the problem lies. I even checked a friend's code from the same tutorial, and it works on his machine. ...

Ways to convert field data to lowercase in MongoDB query result

I have two Objects in my database collection. [ {"_id" : 1, name: "notLowercased"}, {"_id" : 2, name: "lowercased"}, ] Using find and $regex to search for names that include a specific string. data = await Catal ...

React-router-dom causing component not to render

I am currently working on setting up different components to render on different routes within my application. Here is a snippet from my index.js file: ReactDOM.render(<Routes />, document.getElementById('root')); The render function in m ...

Raycasting for collision detection is not very precise

I am facing a challenge in my project where I have multiple irregular shapes like triangles, trapezoids, and other custom designs in a 2D scene all located on the Y=0 axis. I am currently working on writing code for collision detection between these shapes ...

How to retrieve a nested element from a multidimensional array using Angular

Need help with Angular - I'm working on a json file containing an array called people[], which in turn has an array named phones[] I aim to extract and display: people[index].phones[index].phonenumber (assuming people.personid = x and people.phones ...

Tips for displaying JSON data within another array in a Bootstrap table

I'm working with the following JSON data that I need to display in a bootstrap table. I can easily display the single-level data, but I'm unsure how to display array within array data in the bootstrap table. [ { "seriesName": "Indian ...

Is there a way to design OpenStreetMap similar to the aesthetic of coronavirus.app?

Exploring the realm of OpenStreetMap, leaflet, and map tiles has piqued my interest! My initial goal is to create a visually appealing map for data visualization. Having past experience with styling maps client-side through Google Maps, I encountered a r ...

What is the best way to conditionally render table data in React JS using a loop?

Currently, I'm working on a project with React.js and facing challenges in iterating through a data array to selectively render elements based on each data node's properties. The dataset is structured as follows: var requests = [ {"id": ...