Forum Discussion
_anomDiebolt_
7 years agoQrew Elite
More than likely this is the statement that needs to be corrected from:
var recordid = $("ItemID", xml).text();to this:
var recordid = $("itemid", xml).text();The XML tag is derived from the field label by lower-casing all letters and substituting an underscore for non-alphabetic characters. You should expand the xml variable in the console to see the full XML response:
console.dirxml(xml);For what is is worth, I would make further improvements to your code such as the following:
(function() {Also, you probably need to add decoding logic to determine what type of age you are on as I think you code is only going to work for add and edit pages.
var dbid = "myDBID";
var apptoken = "oooolooktokens";
var pro = kRid;
var ntit = _fid_9").value;
var nupc = _fid_75.value;
$.ajaxSetup({data: {apptoken: apptoken}});
var promise = $.get(dbid, {
act: "API_DoQuery",
query: '{35.CT.${ntit}}AND{34.CT.${nupc}}',
clist: "3"
}).then(function(xml) {
console.dirxml(xml);
var recordid = $("itemid", xml).text();
console.log(recordid);
_fid_74.value = recordid;
});
})();