Jump to content
RAGE Multiplayer Community

CEF Variables `undefined`


Recommended Posts

Posted (edited)

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

Client:

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

Anyone?

Edited by hdrtop
Link to post
Share on other sites
Posted (edited)
inventoryUI.execute(`fillMyDiv("${id}", "${money}", "${name}");`);

syntax

 

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

to tidy up your string a bit

Edited by Division
  • Like 1
Link to post
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...