• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Pass variable from client to server-side in NEXTJS

Resolved: Pass variable from client to server-side in NEXTJS

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have already done this but Idk why when I try to apply it again in another code it does not work. So I have this code “Client side”
And this one that is the “Server side”
This is working with another api file I have, so I implement another file that is this one and in another function of the client side make a call to the new api file, the problem is that the variable I want to pass from client to server is the body one, the one that says “holaaaa”, is it not working and it throws this error.
any idea abt this?

Answer:

The request to your API is made, but you are not adding anything to the request body. I think you need to change your DATA property in your fetch call to body:
Also, since you are passing that body parameter to the axios.get() method in your API handler, I assume it’s supposed to be a URL?

If you have better answer, please add a comment about this, thank you!

client-side next.js
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: net::ERR_HTTP2_PROTOCOL_ERROR by http get request angular 15.2

02/04/2023

Resolved: How do I stop the command from happening if the requirements for it to work aren’t sert Discord.js

02/04/2023

Resolved: How to scroll bottom of div at launch?

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.