I've been struggling to accomplish a simple task using Jquery and CSS, but I seem to be stuck.
My issue involves making an ajax request to update a PostgreSQL table and retrieve an id in return. This id corresponds to the id of a row in a previously defined table:
$(document).ready(function(){
var ajaxurl = 'requestsII/updateStatus.php'; // script to execute
data = {datastr:tr_id,datastr1:komvosName,datastr2:current_selection};
$.post(ajaxurl, data, function (response) {
var response = JSON.parse(response);
console.log(response);
var id = response[0]['itemcode']; $("'#"+id+"'").css({backgroundColor: 'red'});
});
});
The goal is to change the color of the row with an id matching this value:
var id = response[0]['itemcode'];
I've experimented with different approaches, but it seems like I'm missing something in my implementation.