WilliamMarrone
8 years agoQrew Cadet
Having trouble getting an API call to fire.
Hello I am a new Quickbase user having a bit of trouble writing a script to return a small sample of data. Below is my code,
var url = "domain";
url += "/db/";
url += "bm9rx6w83";
url += "?a=API_DoQuery";
var request = "<qdbapi>";
request += "<apptoken>tvy5zcdaqafyfxp43vhd78gyys</apptoken>";
request += "<query>{'20'.GT.'1000'}</query>";
request += "<clist>a</clist>";
request += "<options>sortorder-D</options>";
request += "</qdbapi>";
$.ajax({
type: "POST",
contentType: "text/xml",
async: false,
url: url,
data: request,
dataType: "xml",
processData: false,
success: function (response) {
var xml = $(response);
if(xml.find("qdbapi").find('errcode').text() == "0"){
processRecords(xml);
}
else
{
console.log("Quickbase returned an error.");
console.log(response);
}
},
error.function (response) {
console.log("Quickbase Returned an error");
console.log(response);
}
});
function processRecords(xml)
{
xml.find('qdbapi').find('record').each(function(index){
console.log("Name: " + $(this).find("name").text());
console.log("Tuition: " + $(this).find("tuition").text());
console.log("Major: " + $(this).find("major").text());
});
}
I replaced the domain name obviously so that is not the problem but I cannot get a post message to show up with the data. It is only three records in a student table. The only thing I get posted back when I run off MY Iframe button is
XHR finished loading: GET "https://domain/db/bm9rv78gs?a=dbpage&pagename=GetStudents.js&_=1512409558232"....
Anyone have any ideas? I am still pretty new with it so I could just be a gaf on my side.
var url = "domain";
url += "/db/";
url += "bm9rx6w83";
url += "?a=API_DoQuery";
var request = "<qdbapi>";
request += "<apptoken>tvy5zcdaqafyfxp43vhd78gyys</apptoken>";
request += "<query>{'20'.GT.'1000'}</query>";
request += "<clist>a</clist>";
request += "<options>sortorder-D</options>";
request += "</qdbapi>";
$.ajax({
type: "POST",
contentType: "text/xml",
async: false,
url: url,
data: request,
dataType: "xml",
processData: false,
success: function (response) {
var xml = $(response);
if(xml.find("qdbapi").find('errcode').text() == "0"){
processRecords(xml);
}
else
{
console.log("Quickbase returned an error.");
console.log(response);
}
},
error.function (response) {
console.log("Quickbase Returned an error");
console.log(response);
}
});
function processRecords(xml)
{
xml.find('qdbapi').find('record').each(function(index){
console.log("Name: " + $(this).find("name").text());
console.log("Tuition: " + $(this).find("tuition").text());
console.log("Major: " + $(this).find("major").text());
});
}
I replaced the domain name obviously so that is not the problem but I cannot get a post message to show up with the data. It is only three records in a student table. The only thing I get posted back when I run off MY Iframe button is
XHR finished loading: GET "https://domain/db/bm9rv78gs?a=dbpage&pagename=GetStudents.js&_=1512409558232"....
Anyone have any ideas? I am still pretty new with it so I could just be a gaf on my side.