-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
80 lines (66 loc) · 2.47 KB
/
script.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Submitted by Jagadeesh Kumar . S
// My name is Jagadeesh Kumar . S
// My Email Address is jagadeesh_2k17@proton.me
// Kindly contribute some money to my UPI address which is jagadeesh-kumar.ybl
var content = document.getElementById('content');
var active;
var prev;
function data1(ele){
var request = new XMLHttpRequest();
request.open("GET", "https://raw.githubusercontent.com/Rajavasanthan/jsondata/master/pagenation.json", true);
request.send();
request.onload = function () {
var data = JSON.parse(this.response);
content.innerHTML=''
var no;
for(var i = 1; i < 11; i++){
if(document.getElementById(i).classList.contains("active")){
prev=i;
document.getElementById(i).classList.remove("active");
document.getElementById(i).disabled=false;
}
}
if (ele.value == 'Previous'){
prev=prev-1;
no=(prev)*10;
document.getElementById(prev).className='active';
}
else if(prev == 0){
prev = 10;
document.getElementById(prev).className='active';
}
else if (ele.value == 'Next'){
prev=prev+ +1;
no=(prev)*10;
document.getElementById(prev).className='active';
}
else if (ele.value == "First"){
prev = 1;
no=(prev)*10;
document.getElementById(prev).className='active';
}
else if (ele.value == "Last"){
prev = 10;
no=(prev)*10;
document.getElementById(prev).className='active';
}
else{
no=ele.value*10;
}
ele.classList.toggle("active");
if(ele.classList.contains("active")){
ele.disabled = true;
}
for(var i = no - 10; i < no; i++){
content.innerHTML += `id:${data[i].id} </br> name: ${data[i].name} </br> email: ${data[i].email} <br>`
}
document.getElementById('11').disabled=false;
document.getElementById('12').disabled=false;
document.getElementById('13').disabled=false;
document.getElementById('14').disabled=false;
}
}
// Submitted by Jagadeesh Kumar . S
// My name is Jagadeesh Kumar . S
// My Email Address is jagadeesh_2k17@proton.me
// Kindly contribute some money to my UPI address which is jagadeesh-kumar.ybl