Getting job ranks with mysql

Well I’ve been trying since yesterday to register a ServerCallBack and then Trigger it client side in order to output a list of the ranks for a boss menu that I’m creating.
I’m using ESX and here are my code snippets:

Server-Side:

ESX.RegisterServerCallback('bossmenu:fetchranks', function(source, jobname, cb)
	local xPlayer = ESX.GetPlayerFromId(source)
	
	MySQL.Async.fetchAll('SELECT * FROM job_grades WHERE job_name = @jobname ORDER BY grade ASC;',
		{ ['@jobname'] = jobname }
		function(result)
		print(json.encode(result))
	end)
	
	cb(result)
end)

Client-Side:

local result = {}
ESX.TriggerServerCallback('bossmenu:fetchranks', function(result)
    print(result)
end, jobname)

This is the error that I get, and nothing is printed

 SCRIPT ERROR: @pb-ambulancejob/server/main.lua:300: attempt to call a string value (local 'cb')
> TriggerServerCallback (@es_extended/server/functions.lua:160)
> handler (@es_extended/server/common.lua:71)

@TheIndra Thanks for moving it to the appropriate category

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.