DEV Community

Discussion on: I have a question about how to send data to websites

Collapse
 
rossangus profile image
Ross Angus • Edited

The method outlined by @juanfrank77 concerns the sending of the information via the POST method. Personally, I'd just use standard HTML for that task:

<form id="numberForm" method="post" action="https://your-second-website-url-goes-here.test/">
      <label for="numberInput">Enter a number:</label><br>
      <input type="number" id="numberInput" name="numberInput"><br>
      <input type="submit" value="Submit">
</form>
Enter fullscreen mode Exit fullscreen mode

... but that's just me.

In terms of receiving that data and processing it, some form of server-side language would be requited. JavaScript running in the browser is sandboxed so cannot do this, however, as @juanfrank77 points out, when JavaScript runs on the server (in the form of Node.js), then this becomes possible. Note that Node is just one of many languages which could do this, for example .NET, PHP. Perl, if you're feeling nostalgic...

This is probably overkill, but a framework such as Next.js (which encompasses JavaScript, Node and React) is one way to achieve this. But that's a lot to learn!