aboutsummaryrefslogtreecommitdiff
path: root/static/results.js
blob: 5d0be341e6d830f860f4f128be77a59b68643d23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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