function fn_edit_username(method, path) {
method = method || "post";
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
swal({ title: "An input!",
text: "Write something interesting:",
type: "input",
showCancelButton: true,
closeOnConfirm: false,
animation: "slide-from-top",
inputPlaceholder: "Write something"
}, }, function(inputValue) {
if (inputValue === false)
return false;
if (inputValue === "") {
swal.showInputError("You need to write something!");
return false;
}
swal("Nice!", "You wrote: " + inputValue, "success");
document.body.appendChild(form);
form.submit();
});
}
node.js web app. I want to receive input data from the pop-up window and save this value in mysql.
But I was out of my mind.
How do I transfer the value?
I thought it would be okay to do it with post? so I looked it up and tried to try the code together.
app.post('/edit_username', function(req, res) {
pool.getConnection(function(err, conn) {
console.log(req.body.editname);
});
});
But I don't know how to get the price from app.js. I tried to get it with the above, but it's not worth it.
Please let me know if there is a good way or reference document.
node.js javascript
It seems that you are using express, but bodyParser has not been added.
The usage of this part depends on the express version, so it is necessary to check the document that fits the right version.
Please check if the similar part below is added.
// init modules
app.use(express.bodyParser());
562 Who developed the "avformat-59.dll" that comes with FFmpeg?
583 Uncaught (inpromise) Error on Electron: An object could not be cloned
853 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
589 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.