Skip to content
Advertisement

Vue JS – Using URLSearchParams is showing me error

I have an object and I need to pass it to the ajax request.

JavaScript

Here thissearchString is an array of object. I need to pass this array of object to the URL. So, I am using URLSearchParams but got this error message:

JavaScript

Advertisement

Answer

I think you not understand the function of URLSearchParams. Here, what this function do:

JavaScript

With that you can apply multiple function, the common is to use it like that:

JavaScript

Relative to https://developer.mozilla.org/fr/docs/Web/API/URLSearchParams

If i see your code, you want exactly the opposite of that.

You can easly do that like that:

JavaScript

With a array of object:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement