a ja mam następujące pytanie zuwagi na którą funkcję kod musi być uruchamiany z serwera (kod oczywiście działa ale po uruchomieniu go z serwera)
<script type="text/javascript"> <!--
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function submitForm($param){
var wybor = $param;
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert ("Your browser does not support AJAX!");
return;
}
xmlHttp.onreadystatechange=processReqChange;
switch (wybor) {
case 'home':
xmlHttp.open("post","articles/home.html",true);
document.getElementById('map').style.display='none';
break
case 'area':
xmlHttp.open("post","articles/area.html",true);
document.getElementById('map').style.display='block';
break
case 'tariffs':
xmlHttp.open("post","articles/tariffs.html",true);
document.getElementById('map').style.display='none';
break
case 'cars':
xmlHttp.open("post","articles/cars.html",true);
document.getElementById('map').style.display='none';
break case 'contact':
xmlHttp.open("post","articles/contact.html",true);
document.getElementById('map').style.display='none';
break
case 'booking':
xmlHttp.open("post","articles/booking.html",true);
document.getElementById('map').style.display='none';
break
}
xmlHttp.send(null);
}
function processReqChange() {
//alert(xmlHttp.readyState);
//document.getElementById('e2').innerHTML=xmlHttp.readyState;
if(xmlHttp.readyState == 4){
//alert('test2');
if(xmlHttp.status == 200){
var doc = xmlHttp.responseText;
//alert('test3');
//alert(doc);
document.getElementById('element1').innerHTML = doc; // Assign the content to the form
//alert(xhr.status);
}
else{c
document.getElementById('element1').innerHTML="Kod bledu: "+xmlHttp.status;
}
}
}
-->