aboutsummaryrefslogtreecommitdiff
path: root/static/results.js
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-09-09 15:17:58 -0400
committerB. Stack <bgstack15@gmail.com>2022-09-09 15:17:58 -0400
commit6d04ba74279e3e8011a60bde17b2ae4e2a752fa0 (patch)
treece9aa02264b7fc98e507f34b1694e7794e8f9095 /static/results.js
parentuse XDG_CACHE_HOME correctly (diff)
downloadcoupons-6d04ba74279e3e8011a60bde17b2ae4e2a752fa0.tar.gz
coupons-6d04ba74279e3e8011a60bde17b2ae4e2a752fa0.tar.bz2
coupons-6d04ba74279e3e8011a60bde17b2ae4e2a752fa0.zip
add web app
Diffstat (limited to 'static/results.js')
-rw-r--r--static/results.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/static/results.js b/static/results.js
new file mode 100644
index 0000000..5d0be34
--- /dev/null
+++ b/static/results.js
@@ -0,0 +1,22 @@
+/* References:
+ * formie/static/new_form.js
+ */
+function react() {
+ event.preventDefault();
+ // App uses all lowercase matches but does not convert input to lowercase so we must do it here.
+ var ss = document.getElementById("search").value.toLowerCase();
+ var topurl = document.getElementById("topurl").innerHTML;
+ var path = (topurl + "/search/").replace("//","/");
+ let xhr = new XMLHttpRequest();
+ xhr.open("POST", path, false);
+ xhr.setRequestHeader("Accept", "application/html");
+ xhr.setRequestHeader("From", "javascript");
+ // the API supports parameter ?nocache=1 but this is not supported here.
+ xhr.onload = function() {
+ var r = document.getElementById("results");
+ //console.log("Got result:");
+ //console.log(xhr.responseText);
+ r.innerHTML = xhr.responseText;
+ };
+ xhr.send(ss);
+};
bgstack15