Merge branch 'JSON_Post'

This commit is contained in:
MrFry 2020-04-03 11:32:24 +02:00
commit cc8de2e15f

View file

@ -1019,7 +1019,7 @@
sentData.id = GetId()
sentData.quiz = quiz
console.log('SENT DATA', sentData)
SendXHRMessage('datatoadd=' + JSON.stringify(sentData)).then((res) => {
SendXHRMessage(JSON.stringify(sentData)).then((res) => {
next(res.success, sentData, res.newQuestions)
})
} catch (e) {
@ -1623,9 +1623,14 @@
if (now > lastCheck + (infoExpireTime * 1000)) {
return new Promise((resolve, reject) => {
const url = apiAdress +
'infos?version=true&motd=true&subjinfo=true&cversion=' +
info().script.version +
'&cid=' + GetId()
xmlhttpRequest({
method: 'GET',
url: apiAdress + 'infos?version=true&motd=true&subjinfo=true&cversion=' + info().script.version,
url: url,
onload: function (response) {
try {
setVal('lastInfoCheckTime', now)
@ -1668,7 +1673,9 @@
}
params.push(key + '=' + encodeURIComponent(val))
})
url += params.join('&')
url += params.join('&') +
'&cversion=' + info().script.version +
'&cid=' + GetId()
xmlhttpRequest({
method: 'GET',
@ -1712,7 +1719,7 @@
url: url,
data: message,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
'Content-Type': 'application/json'
},
onerror: function (e) {
Log('Data send error', e)