Images 0001, 0002 On MacOS

Popcorn Sales Form Ajax

input.name { position: absolute; left: 120px; }

input.address { position: absolute; left: 120px; }

input.zip { position: absolute; left: 120px; }

input.city { position: absolute; left: 120px; }

input.state { position: absolute; left: 120px; }

img { position: absolute; left: 400px; top: 50px; }

Welcome to Millenium Gynmastics Booster Club Popcorn Sales

Buyer's Name:

Street Address:

Zip code:

City:

State:

picture of popcorn

// Function to get place based on zip code, using XMLHttpRequest

function getPlace(zip) {

var xhr;

if (window.XMLHttpRequest) {

xhr = new XMLHttpRequest();

} else {

xhr = new ActiveXObject("Microsoft.XMLHTTP");

}

xhr.onreadystatechange = function() {

if (xhr.readyState == 4 && xhr.status == 200) {

var result = xhr.responseText;

var place = result.split(', ');

if (document.getElementById("city").value === "") {

document.getElementById("city").value = place[0];

}

if (document.getElementById("state").value === "") {

document.getElementById("state").value = place[1];

}

}

};

xhr.open("GET", "getCityState.php?zip=" + encodeURIComponent(zip), true);

xhr.send(null);

}