From 4da5834934d84a34cbd3aae8138286854cd2da33 Mon Sep 17 00:00:00 2001 From: EvilMuffinHa Date: Sat, 11 Sep 2021 18:04:13 -0400 Subject: [PATCH] callback pls --- cms/src/main.rs | 2 ++ cms/static/utils.js | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cms/src/main.rs b/cms/src/main.rs index 13d78ae..b16642d 100644 --- a/cms/src/main.rs +++ b/cms/src/main.rs @@ -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", diff --git a/cms/static/utils.js b/cms/static/utils.js index 50afc4b..5de1ed4 100644 --- a/cms/static/utils.js +++ b/cms/static/utils.js @@ -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); }