-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.js
54 lines (51 loc) · 1.62 KB
/
content.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
50
51
52
53
const ipoResult = (e) => {
let containerDiv = document.getElementById('results')
containerDiv.innerHTML = ""
let selectedValue = e.target.value;
console.log(`You selected with value ${selectedValue}`);
// Change the profiles object below based on profile you would love to maintain
let profiles = [
{
name: 'Ram',
boid: '123456789123456'
},
{
name: 'Shyam',
boid: '9876543211234567',
},
{
name: 'Hari',
boid: '4563217896541478'
}
]
profiles.forEach((profile)=>{
let body = {
companyShareId: `${selectedValue}`,
boid: `${profile.boid}`
}
fetch("https://iporesult.cdsc.com.np/result/result/check", {
"headers": {
"content-type": "application/json"
},
"body": JSON.stringify(body),
"method": "POST"
})
.then(response => response.json())
.then(data => {
containerDiv.innerHTML += `<strong>${profile.name}</strong>: ${data.message} <br />`
})
.catch((error) => {
console.log(error)
});
});
}
let shareList = document.getElementById('companyShare');
shareList.addEventListener('change', ipoResult)
let containerDiv = document.getElementById('results');
if(containerDiv === null) {
containerDiv = document.createElement("div");
containerDiv.id = "results"
containerDiv.style.backgroundColor = 'orange'
containerDiv.style.fontSize = '4 px'
shareList.parentNode.insertBefore(containerDiv, shareList)
}