Expand all | Collapse all

$.getScript() not working

  • 1.  $.getScript() not working

    Posted 11-26-2018 19:16
    I am trying to access data from two fields in another table. To prepare, i made a specific report that only reports these two fields (Record ID# and Name).

    I have tried to use $.getScript() to obtain an array using the jsa parameter, however nothing within the promise works, and i am unable to see either console.log(). I have looked all over quickbase for similar problems with $.getScript(), yet i still cannot figure out what the problem is with this section of code.


            console.log("qdb_data Test");


    Just to be clear, i am NOT receiving any errors in the console log, rather it is as if the code is just not being fulfilled. I assume it is a syntax error in the URL but i am not sure as ive edited it multiple times to make sure.

  • 2.  RE: $.getScript() not working

    Posted 11-27-2018 07:48
    You have at least three errors - maybe more:

    (1) You are specifying both a native action ?a=q and an API action &act=API_GenResultsTable. 

    (2) You are using the application dbid (bk63yxbf9) not a table dbid.

    (3) You are not specifying an application token.

    To avoid some of these issues you might want to parameterize and clear up you code like so:
    var dbid = "";
    var dbidTable = "";
    var apptoken = "";
    $.ajaxSetup({data: {apptoken}});
    var params = {
      act: "API_GenResultsTable",
      qid: "140",
      jsa: "1"
    var url = '${dbidTable}?${$.param(params)}';
      .then(() => {
        console.log("qdb_data Test");

  • 3.  RE: $.getScript() not working

    Posted 11-27-2018 18:23
    I should have put my full code up just so there could be more background as to what was going on, my mistake. I was however able to fix the code by making your first suggested change which was to get rid of the  native action "a=q" in my getScript url, and i am now able to see the qdb_data! Thank you for your help and i will start working on trying to parameterize the code to clear it up like you said.

    var data = "<qdbapi>\r\n   <username></username>\r\n   <password></password>\r\n   <apptoken>"my apptoken here"</apptoken>\r\n  <clist>3.252</clist>  <jsa>1</jsa> \r\n </qdbapi>";

    var xhr = new XMLHttpRequest();

    xhr.withCredentials = true;

    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
    $.getScript("bk63yxbf9?qid=140&act=API_GenResultsTable&jsa=1",function(){ // removed "a=q"
              console.log("Hello World");
              console.log("qdb_data Test");
    xhr.open("POST", "https://website.quickbase.com/db/bk63yxbf9?a=q&qid=140");
    xhr.setRequestHeader("Content-Type", "text/xml");
    xhr.setRequestHeader("QUICKBASE-ACTION", "API_GenResultsTable");
    xhr.setRequestHeader("cache-control", "no-cache");
    xhr.setRequestHeader("Postman-Token", "91d79d23-22d3-45c8-85c3-0e1d0870969c"); //postman token

    The DBID that i was using is in fact the DBID for the table, i checked this by going into the app settings ----> app management ---> app statistics, and choosing the ID that was listed for the table i was using. 

    thank you again!

  • 4.  RE: $.getScript() not working

    Posted 11-28-2018 12:41
    If what you have works problem solved.

    However, I don't understand why you are using XHR if you are also using jQuery AJAX methods or why you would need to wrap any AJAX method around your $.getScript() call. jQuery's AJAX methods provide a superior abstraction over raw XHR and even if you needed to use a raw JavaScript API for network requests you should use the fetch API.

    Again, if you have a solution that works go with that. But you will achieve even greater capabilities by slowly migrating to modern JavaScript APIs.