Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PostData() {
- // 1. Istanziazione della richiesta (semplificata)
- var xhr;
- xhr = new XMLHttpRequest();
- // 2. Gestire la risposta del server
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4) {
- if (xhr.status == 200 && xhr.status < 300) {
- document.getElementById('div1').innerHTML = xhr.responseText;
- }
- }
- }
- // 3. Specificare metodo, URL e avviare le operazioni
- var userid = document.getElementById("userid").value;
- xhr.open('POST', 'controllo.php');
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- xhr.send("userid=" + userid);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement