News:

Wondering if this will always be free?  See why free is better.

Main Menu

Ajax stuff

Started by mediman, August 01, 2005, 03:24:35 PM

Previous topic - Next topic

mediman

i try to use ajax (XmlHttpRequest and this cool stuff)

what i try:

when a user puts in a postal code in a input field, the city,  fitting this zip, should appear in a select box (coz any cities share their postal codes with others).

the postal codes and cities are stored in a db ...

for this i want to use ajax.

i made my firsts tests with ajax

<html>
<body>
<script language="javascript">
function loadFragmentInToElement(fragment_url, element_id) {
    var element = document.getElementById(element_id);
    element.innerHTML = '<p><em>Loading ...</em></p>';
    xmlhttp.open("GET", fragment_url);
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            element.innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.send(null);
}

</script>
<a href="#" onclick="javascript:loadFragmentInToElement('text.html', 'bla')">load</a>
<div id="bla">
</div>
</body>
</html>


but it seems i am to stupid || to old || (to stupid && to old)

any idea?

p.s. the code above has nothing to do with the prob itself but was a test of xmlhttprequest
My Projects: http://ticker-oase.de 
Please do not PM me with support requests.

Advertisement: