Jump to content

CEF Variables `undefined`


Recommended Posts

Hello, I'm passing variables from client-side to my CEF page.


mp.events.add("fillDiv", (player, id, money, name) => {
	inventoryUI.execute(`fillMyDiv(\`"${id}, ${money}, ${name}"\`);`);
	// in console, the values shows good

main.js (included as script in money.html):

function fillMyDiv(id, money, name) {
    var table = document.getElementById("container_inv");
    table.innerHTML += "<div name="+id+">($"+money+") - "+ name+ "</div>";

Im getting

($undefined) - undefined


Edited by hdrtop
Link to comment
Share on other sites

inventoryUI.execute(`fillMyDiv("${id}", "${money}", "${name}");`);



table.innerHTML += `<div name="${id}">($ ${money}) - ${name}</div>`;

to tidy up your string a bit

Edited by Division
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...