DevDetails refactor

This commit is contained in:
Jokob-sk
2024-03-22 23:05:52 +11:00
parent f9a999c4d0
commit bb2accc194
6 changed files with 52 additions and 188 deletions

View File

@@ -3,14 +3,14 @@
// -----------------------------------------------------------------------------
// Read data and place intotarget location, callback processies the results
function readData(sqlQuery, processDataCallback, valuesArray, targetLocation) {
function readData(sqlQuery, processDataCallback, valuesArray, targetLocation, targetField) {
var apiUrl = `php/server/dbHelper.php?action=read&rawSql=${encodeURIComponent(sqlQuery)}`;
$.get(apiUrl, function(data) {
// Process the JSON data using the provided callback function
data = JSON.parse(data)
var htmlResult = processDataCallback(data, valuesArray);
var htmlResult = processDataCallback(data, valuesArray, targetField);
// Place the resulting HTML into the specified placeholder div
$("#" + targetLocation).replaceWith(htmlResult);