Jump to content

Issue with exporting GetElementData in executeBrowserJavascript


SenX.

Recommended Posts

Hi! l need help exporting data from 'GetElementData' using executeBrowserJavascript

Here is a snippet from the code:

Client:

local browser = guiGetBrowser(guiCreateBrowser(0, 0, 1920, 1080, true, true, true))

addEventHandler("onClientBrowserCreated", browser,
    function ()
        loadBrowserURL(source, "http://mta/account/Characters/MainMenuChar.html")
		showCursor(true)
		setDevelopmentMode(true, true)
    end)

addEventHandler("onClientBrowserDocumentReady", browser,
    function ()
		executeBrowserJavascript(source,
		"document.getElementById('nickname').innerHTML = '" .. getElementData(thePed,"account:charselect:name") .. "'");
end)

it does not work with CEF(HTML) files, when you call 'GetElementData' using the GUI, everything works and is displayed correctly.

When entering a standart varible, for example getPlayerName(localplayer) everything is also displayed in CEF and in the GUI

 Problems with the HTML file are excluded, except that there are no additional scripts using JavaScript (tell me, are they required?)

P.S Thank you in advance for each of your answers, maybe they will help not only me, but also other newcomers in our community

Link to comment
  • Scripting Moderators

Maybe getElementData returned a boolean value?
see the debug if there is any error,

Also are you sure from the key and thePed?
because i don't see it in your code

Edited by xLive
Link to comment

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...