am o problema de inserare
Cod: Selectaţi tot
<script type="text/javascript">
function getStates()
{
var xmlhttp;
try {
xmlhttp = new XMLHttpRequest;
}catch(e)
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if(xmlhttp)
{
var form = document['form1'];
var country = form['country'].value;
xmlhttp.open("GET", "getStates.php?country="+country, true);
xmlhttp.onreadystatechange = function ()
{
if(this.readyState == 4)
{
var s = document.createElement("select");
s.name= "state";
s.innerHTML = this.responseText;
if(form['state'])
{
form.replaceChild(s, form['state']);
}else
form.insertBefore(s, form['country']);
}
}
xmlhttp.send(null);
}
}
</script>
Acesta este codul si as dori sa-mi afiseze formul state dupa formul country
Am incercat ci insertAfter dar nu merge
Tin sa mentionez ca nu stiu prea multe despre AJAX dar stiu ce fac daca ma uit peste cod.
O zi buna