Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Twitter


In this Discussion

El fin de este foro es dar soporte gratuito y comercial a los distintos productos y servicios de El soporte gratuito se brinda en los foros de acceso público y no tiene garantía de tiempo mínimo de respuesta. El soporte comercial se brinda en foros privados donde se garantiza una respuesta dentro de las 24 horas.

Javascript code to send request to ehrserver rest api.

I wanted to send a post login request to ehrserver api, i typed in the following code but it says 401 unauthorized error in console. 
  <div class="login">
    <form method="post">
    <input type="text" name="u" placeholder="Username" id="username" required="required" />
        <input type="password" name="p" placeholder="Password" id="password" required="required" />
        <input type="text" name="p" placeholder="Organization" id="organization" required="required" />
        <button type="submit" id="submit">Let me in.</button>

  var btn = document.getElementById("submit");
  btn.addEventListener("click", function(){
var username = document.getElementById("username");
var password = document.getElementById("password");
var organization = document.getElementById("organization");
var url = baseurl;
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
  if(xmlHttp.readyState === XMLHttpRequest.DONE && xmlHttp.status === 200) {
}; "POST", url, true); // false for synchronous request     




Sign In or Register to comment.