HTML Input to Lua Variable?

Hi, I was wondering if it is possible to make a html input form into a lua variable. (I heard it was possible through javascript)
HTML:

				<form id="cc-form">
					<input id="firstname" type="text" placeholder="First Name"><br>
					<input id="lastname" type="text" placeholder="Last Name"><br>
					<input id="dob" type="text" placeholder="DOB (mm/dd/yyyy)"><br>
					<button id="submit" type="submit">Log In</button>
				</form>

I am using this with @WolfKnight179 's Action Menu.

When you press the submit button, use JavaScript to grab the contents of each input, then send it via the NUI system to the Lua side.

html:

                <form id="cc">
					<input id="firstname" type="text" placeholder="First Name"><br>
					<input id="lastname" type="text" placeholder="Last Name"><br>
					<!--<input id="dob" type="text" placeholder="DOB (dd/mm/yyyy)"><br>-->
					<input type="submit" value="Submit">
				</form>

js:

$("#cc").submit(function(e) {
    e.preventDefault(); // Prevent form from submitting
    $.post('http://wk_actionmenu/cc', JSON.stringify({
        username: $("#firstname").val(),
        password: $("#lastname").val()
    }));
});

Now what would I put in Lua to be able to do this?

RegisterNetEvent("ID")
AddEventHandler("ID", function(RPname)
    TriggerClientEvent("chatMessage", -1, "ID", {255,255,255}, "Name: "..firstname)
end)

You would need to use an NUI callback, there’s a function in the ActionMenu JS called sendData, use that instead.

sendData( "formSubmit", { username: $("#firstname").val(), password: $("#lastname").val() } ); 

Then on the Lua side:

RegisterNUICallback( "formSubmit", function( data, cb ) 
    -- do what you want with the data variable 
end )

So where do I put that? Like this:?

$("#cc").submit(function(e) {
    e.preventDefault(); // Prevent form from submitting
    sendData( "formSubmit", { username: $("#firstname").val(), password: $("#lastname").val() } );
    }));
});

Yeah.

20fuckingchars.

Could you send an example? It does not want to working :confused: I tried using chatPrint from your action menu @WolfKnight179 but it is not working. :frowning: