I need help from javascript/node.js expert. I need someone to write a sample workable code that calls $.ajax POST call from html to node.js server and this call must pass data from $.ajax to node.js and send sample response back to html. Your code must be able to run on my system and so you will send me your code to verify everything works. Below is an extract of my code which does not pass data to node.js. It does a post to the node.js server but I do not see the parameters in the querystring or payload on the node.js server.
1. My sample Javascript in html
var postFunction = function() {
$.ajax({
type: 'POST',
url: '[login to view URL]',
data: {inputdata:'david'},
dataType: "html",
processData:false,
success: function (data) {
alert(data)
}
})
}
2. My sample node.js
const http = require('http');
const hostname = '[login to view URL]';
const port = 3000;
var querystring = require('querystring');
var url = require('url');
const server = [login to view URL]((req, res) => {
var pathname = [login to view URL]([login to view URL]).pathname;
[login to view URL]('[login to view URL]: ' + [login to view URL]);
[login to view URL]('[login to view URL]: ' + [login to view URL]);
[login to view URL]('[login to view URL]: ' + [login to view URL]);
[login to view URL]('[login to view URL]: ' + [login to view URL]);
[login to view URL]('[login to view URL]: ' + [login to view URL]);
[login to view URL]('[login to view URL]: ' + [login to view URL]);
[login to view URL]("hello");
}
[login to view URL](port, hostname, () => {
[login to view URL](`Server running at http://${hostname}:${port}/`);
});
Hello ,
I am Rupak Banerjee. I have got 16+ years of experience in web application development.
I can write you the nodejs code for you in no time.
Hope to hear from you soon.
Thanks And Regards,
Rupak Banerjee,