Last active
July 31, 2019 10:47
-
-
Save hsyntnc/a488a5dece996dafdbb58000afad8e8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
total = 0; | |
function makeRequest(page, archived) { | |
var ysRequest = { CatalogName: "", Culture: "tr-TR", LanguageId: "", Token: ""} | |
var data = { archiveDbOrders: archived, pageNumber: page, ysRequest: ysRequest } | |
$.ajax({ | |
type: "POST", | |
url: "https://www.yemeksepeti.com/Account/GetOrderHistory", | |
data: data, | |
success: function(resp){ | |
resp.OrderHistoryItems.forEach(item => { | |
total = total + parseFloat(item.Total.split(' ')[0].replace(',', '.')) | |
console.log(item.Total + ' ' + item.OrderDateText); | |
}); | |
if (resp.HasNextPage){ | |
makeRequest(page+1, archived) | |
} else if (archived == false) { | |
makeRequest(1, true) | |
} else { | |
alert("Toplam Harcamanız: ₺" + total.toFixed(2)); | |
} | |
} | |
}); | |
} | |
makeRequest(1, false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment