I added a few minor modifications to test out functionality & the changes work locally but not on the server. When run locally I click my testing button to execute a block of code and it executes and returns table data. When I make the same changes to the same files on the server I get a resource not found error.
Changes made:
Added button to index.html
Added event handler registration and table lookup to end of script.js
//TZ Testing Section
$(’#tztest’).on(‘click’, function () {
console.log(“tztest…”);
showContactsPlusGroups();
});
var cg_params = ‘related=contact_by_contact_id, contact_group_by_contact_group_id’;
function showContactsPlusGroups() { $.api.getRecords(‘contact_group_relationship’, cg_params, getToken(‘token’), populateContactsPlusGroupsTable); }
var populateContactsPlusGroupsTable = function(data_) {
// var table = $(’#table_01’).DataTable();
var contactsWithGroups = [];
$.each( data_, function (id_, value_) {
contactsWithGroups.push( [
value_.contact_by_contact_id.first_name + " " + value_.contact_by_contact_id.last_name,
value_.contact_group_by_contact_group_id.name
]);
} );
$.each( contactsWithGroups, function(id_, value_ ) {
console.log( value_[0] + "|" + value_[1] );
});
// $(’#table_01’).DataTable().clear().rows.add(contactsWithGroups).columns.adjust().draw();
};
$(document).ready(function() {
window.alert(“tz version”);
}
);