0
Good Morning,
I am trying to load a value into Input after the user clicks the button.
// Este é o Botão
<button type="button" class="btn btn-default" tabindex="-1" onclick="id_host()"> Identificar Nome </button>
When he clicks on this button, I want him to go to a page .php
and make a gethostname()
and return with the result by assigning in the input.
Follow the code for better understanding:
// Função quando Clicar no Botão.
function id_host() {
var n_pc = $("#conteudo").load("processa.php");
document.getElementById('#conteudo').value = n_pc;
}
This is the Input I want popular with the result of processa.php
<input type="text" class="form-control" name="conteudo" id="conteudo" value="">
Can someone help me?
Grateful.
The
load
will load the output fromprocessa.php
into the element with id 'content'. Then you should do itvar n_pc = $("#conteudo").text();
– Franchesco
I didn’t understand, in case it would look like this:
$("#conteudo").load("processa.php");
andvar n_pc = $("#conteudo").text();
??– Ana Olivier
That’s right. The
load
does not return anything, it just 'plays' the content in the 'content' element'.– Franchesco
Man, it didn’t work out! =/
– Ana Olivier
What your
processa.php
returns, a plain text, an html, a json or what?– KaduAmaral