var sumCash = 0;
var cashList=[];
var start = 0;
var end = 0;
var regex = '/[^0-9]/g'
$.ajax({
url: 'https://member.nexon.com/cash/chargelist.aspx',
type: 'GET',
data: { pageno: '1', pagecode: '1', year: '2017', month: '12'},
dataType: 'html',
async: false,
success: function (data) {
start = data.indexOf('var data1 = [')
end = data.indexOf('var data2')
var arr = data.substring(start+13, end-8).split(',')
arr.forEach((value)=>{
cashList.push(value)
})
start = data.indexOf('var data2 = [')
end = data.indexOf('var option')
var arr = data.substring(start+13, end-8).split(',')
arr.forEach((value)=>{
cashList.push(value)
})
},
error: function (xhr, status, error) {
console.log(error);
}
});
for(var i = 2018; i <= 2022; i++){
$.ajax({
url: 'https://member.nexon.com/cash/chargelist.aspx',
type: 'GET',
data: { pageno: '1', pagecode: '1', year: i, month: '1'},
dataType: 'html',
async: false,
success: function (data) {
start = data.indexOf('var data1 = [')
end = data.indexOf('var data2')
var arr = data.substring(start+13, end-8).split(',')
arr.forEach((value)=>{
cashList.push(value)
})
start = data.indexOf('var data2 = [')
end = data.indexOf('var option')
var arr = data.substring(start+13, end-8).split(',')
arr.forEach((value)=>{
cashList.push(value)
})
},
error: function (xhr, status, error) {
console.log(error);
}
});
}
cashList.forEach((value) => {
sumCash += Number(value);
})
alert("현재까지 넥슨에 쏟아부은 금액은 " + sumCash.toLocaleString() + "원 입니다.")