1
Help for ParamQuery Pro / Help with parsing JSON recordset - after grid refresh
« on: January 13, 2016, 10:38:19 pm »
I have a working grid but need to disable an "add" button on the grid toolbar after posted data is inserted into the grid. To do it, I run a function that gets a recordset from the database and need to parse that JSON to set some local variables.
i know this is simple and really not an issue for the grid itself, but I can't see how to do parse the returned data which looks like:
{"DATA":[{"logins_remaining":0,"login_count":10}]}
The function is called after the grid refreshes. Can you provide a hint on how to parse the JSON?
function refreshLoginCount() {
//get a query recordset of counts from server
$.get("/_resources/cfc/logins.cfc?method=getActiveLoginCount&account_id=" + $account_id, function(data, status){
// This is the response from server >> {"DATA":[{"logins_remaining":0,"login_count":10}]}.
// I want to set some Jquery variables, for example >> $logins_remaining = 0 AND $("#login_count").html("10");
});
}
i know this is simple and really not an issue for the grid itself, but I can't see how to do parse the returned data which looks like:
{"DATA":[{"logins_remaining":0,"login_count":10}]}
The function is called after the grid refreshes. Can you provide a hint on how to parse the JSON?
function refreshLoginCount() {
//get a query recordset of counts from server
$.get("/_resources/cfc/logins.cfc?method=getActiveLoginCount&account_id=" + $account_id, function(data, status){
// This is the response from server >> {"DATA":[{"logins_remaining":0,"login_count":10}]}.
// I want to set some Jquery variables, for example >> $logins_remaining = 0 AND $("#login_count").html("10");
});
}