I am facing a very complex issue that requires an in-depth understanding. If this interests you, please continue reading.
I have developed a program from scratch that generates an HTML page for user data input and submission. The submitted data is sent to a local node.js server that simply logs it to the console. The data is passed through a querystring in the URL, such as
http://localhost/?<parametersGoHere>
. The client files are hosted using the node.js module http-server, which can be found at https://github.com/nodeapps/http-server.
The problem I am facing is that the ajax call to the node.js server fails every time. I can manually enter the URL with parameters and get the expected results, but the ajax call does not work as expected. I suspect the issue lies within the network.js file. Can anyone help me identify and solve this error?
Below is the code for the node.js server:
(server.js file content goes here)
The following are the scripts running on the HTML page:
(scripts.js content goes here)
Here is the HTML content of the page:
(HTML content goes here)
Lastly, here is the network.js code which is called when the submit function is triggered:
(network.js content goes here)
I understand that this is a lengthy amount of code. Please feel free to provide feedback on how I can make it more understandable or readable. Leave a comment if you need any clarification.