Forum Discussion

Winss's avatar
Winss
Qrew Trainee
4 years ago

Example on using Rest webservice of Quickbase in an HTML page

Could anyone please provide me an example on where REST service of  quickbase is used in an HTML page. 
I have given below a GET method to query, but this is wrong. Please give an example similar to this to use in HTML page.
<html>
  <head>
    <title> Person Information </title>
    <meta charset="UTF-8">
    <script>
      var baseurl = "https://companyname.quickbase.com/bq8yoyo5b";
      function loadPersons(){
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.open("GET",baseurl + "?a=API_DoQuery&includeRids=1&user_token="asdsd----------------uty----m"&query='{"7".LT.9}'",true);
        xmlhttp.onreadystatechange = function() {
          if(xmlhttp.readyState ===4 && xmlhttp.status ===200){
            var persons = JSON.parse(xmlhttp.responseText);
            var tbltop = `<table>
			    <tr><th>Id</th><th>First Name</th><th>Last Name</th><th>Age</th></tr>`;
            //main table content we fill from data from the rest call
            var main ="";
            for (i = 0; i < persons.length; i++){
              main += "<tr><td>"+persons.id+"</td><td>"+persons.firstName+"</td><td>"+persons.lastName+"</td><td>"+persons.age+"</td></tr>";
            }
            var tblbottom = "</table>";
            var tbl = tbltop + main + tblbottom;
            document.getElementById("personinfo").innerHTML = tbl;
          }
        };
        xmlhttp.send();
      }
      window.onload = function(){
        loadPersons();
      }
    </script>
  </head>
  <body>
    <div id="personinfo"> </div>
  </body>
</html>​



------------------------------
Aswin Babu
------------------------------
No RepliesBe the first to reply