-
Notifications
You must be signed in to change notification settings - Fork 4
/
payment.js
31 lines (27 loc) · 1.06 KB
/
payment.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
document.querySelector("#parent").addEventListener("submit",paynow);
var paymentList = JSON.parse(localStorage.getItem("payment")) || [];
function paynow(event)
{
event.preventDefault();
var email = document.querySelector("#email").value;
var name = document.querySelector("#name").value;
var address = document.querySelector("#address").value;
var cardnumber = document.querySelector("#cardnumber").value;
var cardname = document.querySelector("#cardname").value;
var expairyDate = document.querySelector("#expairyDate").value;
var securityCode =document.querySelector("#securityCode").value;
var paymentObj={
email : email,
name : name,
address : address,
cardnumber : cardnumber,
cardname : cardname,
expairyDate : expairyDate,
securityCode : securityCode
};
console.log(paymentObj);
paymentList.push(paymentObj);
console.log(paymentList);
localStorage.setItem("payment",JSON.stringify(paymentList))
alert("Payment Successful");
}