-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
49 lines (37 loc) · 1.6 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const express = require("express");
const bodyParser = require("body-parser");
const app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.get("/", function(req, res) {
res.sendFile(__dirname + "/index.html");
});
app.get("/customer.html", function(req, res) {
res.sendFile(__dirname + "/customer.html");
});
app.get("/index.html", function(req, res) {
res.sendFile(__dirname + "/index.html");
});
app.post("/", function(req, res) {
res.send("thanks for sending your form");
});
app.listen(3000, function() {
console.log("Server has started on port 3000");
});
function sendMoney() {
var enterName = document.getElementById("enterName").value;
var enterAmount = parseInt(document.getElementById("enterAmount").value);
var enterSName = document.getElementById("enterSName").value;
var findSenderBankAccount = enterSName + "BankBalance";
var enterSAmount = parseInt(document.getElementById(findSenderBankAccount).innerHTML);
if (enterAmount > enterSAmount) {
alert("Insufficient Balance.");
} else {
var findUserBankAccount = enterName + "BankBalance";
var finalAmount = parseInt(document.getElementById(findUserBankAccount).innerHTML) + enterAmount;
var myAccountBalance = parseInt(document.getElementById(findSenderBankAccount).innerHTML) - enterAmount;
document.getElementById(findSenderBankAccount).innerHTML = myAccountBalance;
document.getElementById(findUserBankAccount).innerHTML = finalAmount;
alert(`Successful Transaction !!
$${enterAmount} is sent to ${enterName}@gmail.com.`);
};
};