callback pls

This commit is contained in:
EvilMuffinHa 2021-09-11 18:04:13 -04:00
parent f9b9cae6eb
commit 4da5834934
2 changed files with 6 additions and 2 deletions

View File

@ -84,6 +84,8 @@ fn rocket(port: u16, address: String, env: Environment, pg: PgConnection, sa: Se
data::ssl_ops::api,
data::calendar::api,
data::polls::api,
data::new::api,
data::important::api
])
.mount(
"/ui",

View File

@ -13,15 +13,17 @@ function forwardForImage(id, postloc) {
}
if (form_elem[i].type == "file") {
var file = document.getElementById(form_elem[i].id).files[0];
getBase64(file, form_elem, i, data, (form_elem, i, data, res) => {
data.push(form_elem[i].name + "=" + res);
getBase64(file, form_elem, i, data, function(form_elem, i, data, res) {
data.push(form_elem[i].name + "=" + encodeURIComponent(res));
});
}
}
console.log(data);
console.log(data[3]);
var params = data.join("&");
var xhr = new XMLHttpRequest();
xhr.open("POST", postloc, true);
console.log(params);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send(params);
}