[Vuejs]-Problem with JSON passing strings like // or #

0👍

In your code, you have:

.post('../procesarProductos/2/' + JSON.stringify({...})

Don’t concatenate the data into the URL. You’re using POST, so instead you should be posting a request body.

I don’t use Axios so I can’t tell you how to use it there, but with most similar utilities, this is something like:

.post('../procesarProductos/2', {
  body: JSON.stringify({...}),
  headers: {
    'Content-Type': 'application/json'
  }
)

On the PHP end, you can receive it by parsing the result of.
file_get_contents('php://input') (See also: https://stackoverflow.com/a/37847337/362536)

By using the request body, you won’t have to worry about length limits, nor URI encoding.

Also, please for future Stack Overflow questions, post your actual code and not screenshots.

Leave a comment