Send an input value via ajax

Asked

Viewed 26 times

0

Hello folks I have an input with the following function

<input id="cpf"onblur="buscacpf()">

below is the function .

<script>
function buscacpf() {
  var x = document.getElementById("cpf").value;

alert(x);
}
</script> 

something very basic namely when I left this input by the onblur method it returns me the value that was typed in the input, however I need to take this value that is a Cpf and return the name of the client, some searches done on the internet led me to do this via ajax, but I’m a beginner and I don’t know how to make it work.

As it is the ajax script that will take this value and send to another page, this working would already be 50% because the query I know how to do there would only be to return this query to the first page .

  • Search by "AJAX" in the site search field that there are numerous examples.

  • I’ve done it but appears numerous much more advanced subjects nothing like mine, has some post similar to this my problem ?

  • You can take a look in this W3S doc... has even a basic and functional example. Basically it is: vc requests a file on the server (e.g. PHP) sending the number of the CPF, searches the CPF in the database and returns the name.

  • Josenildo, AJAX is really very good, there are many libraries that assist in child Ajax code, facilitating its creation. One of them is the most famous and well-known Jquery javascript library. Here has a link that can help you make your solution.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.