hdrtop Posted May 4, 2020 Posted May 4, 2020 (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 May 4, 2020 by hdrtop
Division Posted May 5, 2020 Posted May 5, 2020 (edited) inventoryUI.execute(`fillMyDiv("${id}", "${money}", "${name}");`); syntax table.innerHTML += `<div name="${id}">($ ${money}) - ${name}</div>`; to tidy up your string a bit Edited May 5, 2020 by Division 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now