version 1.49, 2024/03/29 20:13:18 |
version 1.65, 2024/03/30 16:16:46 |
Line 44 async function sendData() { |
|
Line 44 async function sendData() { |
|
callback: function(token) { |
callback: function(token) { |
ii.textContent="Sent"; |
ii.textContent="Sent"; |
console.log(`Challenge Success ${token}`); |
console.log(`Challenge Success ${token}`); |
/* --------------------- */ |
const dataToSend = JSON.stringify({"add": em, "sub": su, "msg": ms, "tok": token}); |
const ob = {mail: em, sub: su, msg: ms, id: token }; |
console.log(`JSON: ${dataToSend}`); |
var data="", |
|
status="", |
|
feed=JSON.stringify(ob); |
|
$.post("/feedbk/", feed, function(data, status){ |
fetch("/feedbk/", { |
console.log("Data: " + data + "\nStatus: " + status); |
credentials: "same-origin", |
console.log("JSON: " + JSON.parse(data.getJSON())); |
mode: "same-origin", |
|
method: "post", |
}); |
headers: { "Content-Type": "application/json" }, |
/* --------------------- */ |
body: dataToSend |
//ovar re=""; |
}) |
//const dataToSend = JSON.stringify({"email": "hey@mail.com", "password": "101010"}); |
.then(response => response.json()) |
//let dataReceived = ""; |
.then(json => console.log(json)) |
//fetch("/feedbk/", { |
|
// credentials: "same-origin", |
|
// mode: "same-origin", |
|
// method: "post", |
|
// headers: { "Content-Type": "application/json" }, |
|
// body: dataToSend |
|
//}) |
|
// .then(resp => { |
|
// if (resp.status === 200) { |
|
// return resp.json() |
|
// } else { |
|
// console.log("Status: " + resp.status) |
|
// return Promise.reject("server") |
|
// } |
|
// }) |
|
// .then(dataJson => { |
|
// dataReceived = JSON.parse(dataJson) |
|
// }) |
|
// .catch(err => { |
|
// if (err === "server") return |
|
// console.log(err) |
|
// }) |
|
//console.log(`Received: ${dataReceived}`) |
|
|
|
|
|
}, |
}, |
}); |
}); |