I have problem with AJAX and database. I don't know what I have now to do. So, I have this AJAX code:
<script>
function showCity(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","rozpiski.php?q="+str,true);
xmlhttp.send();
}
}
</script>
I want: When user select some option, the second select list shows value (after gets this values from database).
This is my code HTML:
<select name="country3" onchange="showCity(this.value)"> <option>Anglia</option><option selected='selected'>Austria</option><option>Belgia</option><option>Czechy</option><option>Dania</option><option>Estonia</option><option>Finlandia</option><option>Francja</option><option>Holandia</option><option>Islandia</option><option>Lichtenstein</option><option>Luxembourg</option><option>Niemcy</option><option>Norwegia</option><option>Polska</option><option>Szwajcaria</option><option>Szwecja</option><option>Słowacja</option><option>Słowenia</option><option>Wyspy Owcze</option><option>Węgry</option><option>Włochy</option><option>Łotwa</option><option>Anglia</option><option>Austria</option><option>Belgia</option><option>Czechy</option><option>Dania</option><option>Estonia</option><option>Finlandia</option><option>Francja</option><option>Holandia</option><option>Islandia</option><option>Lichtenstein</option><option>Luxembourg</option><option>Niemcy</option><option>Norwegia</option><option>Polska</option><option>Szwajcaria</option><option>Szwecja</option><option>Słowacja</option><option>Słowenia</option><option selected='selected'>Wyspy Owcze</option><option>Węgry</option><option>Włochy</option><option>Łotwa</option><option>Anglia</option><option>Austria</option><option>Belgia</option><option>Czechy</option><option>Dania</option><option>Estonia</option><option>Finlandia</option><option>Francja</option><option>Holandia</option><option>Islandia</option><option>Lichtenstein</option><option>Luxembourg</option><option>Niemcy</option><option>Norwegia</option><option>Polska</option><option>Szwajcaria</option><option>Szwecja</option><option>Słowacja</option><option>Słowenia</option><option>Wyspy Owcze</option><option>Węgry</option><option>Włochy</option><option>Łotwa</option></select></td>
<td><select name="city" id="3"></select>
When the user in country3 select for example Polska, he gets in 2nd select cities from Polska. This cities are in database. How to do it?
This should be simple but I guess no jQuery makes it a bit difficult. I want to repeat a process where a div goes 100px to the right (with animation) and then 100px to the left (so i want a continuous ...
This should be simple but I guess no jQuery makes it a bit difficult. I want to repeat a process where a div goes 100px to the right (with animation) and then 100px to the left (so i want a continuous ...
I have used Dylan's question on here regarding JavaScript syllable counting, and more specifically artfulhacker's answer, in my own code and, regardless of which single or multi word string I feed it, ...
I have used Dylan's question on here regarding JavaScript syllable counting, and more specifically artfulhacker's answer, in my own code and, regardless of which single or multi word string I feed it, ...
I am doing image editing integration with Aviary. Below is the html code <body> <a href="#" onclick="return launchEditor('editableimage1','http://www.html5canvastutorials.com/demos/assets/...
I am doing image editing integration with Aviary. Below is the html code <body> <a href="#" onclick="return launchEditor('editableimage1','http://www.html5canvastutorials.com/demos/assets/...
Hey I have a login form that when you click on the input the label move up, after focus out it checks if there is text in the input and if have the label stays up if dont the label comes down. My ...
Hey I have a login form that when you click on the input the label move up, after focus out it checks if there is text in the input and if have the label stays up if dont the label comes down. My ...