Forum Discussion

Winss's avatar
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.
    <title> Person Information </title>
    <meta charset="UTF-8">
      var baseurl = "";
      function loadPersons(){
        var xmlhttp = new XMLHttpRequest();"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>""</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;
      window.onload = function(){
    <div id="personinfo"> </div>

Aswin Babu
No RepliesBe the first to reply