*Markus: (AJAX) Statuscode manchmal 0, wieso?

Beitrag lesen

Hallo,

ok, danke. Ich weiß jetzt, was du meinst. Dennoch besteht das Problem trotzdem. Was ich eigentlich erreichen will:
Ich will auf einer Seite zwei oder mehr Formulare haben, die unabhängig voneinander abgeschickt werden können, ohne, dass die komplette Seite neu geladen wird, und somit die anderen Formularfelder der anderen Formulare wieder gelöscht sind.
Hier nochmal das Script.

  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"  
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />  
<meta http-equiv="Content-Style-Type" content="text/css" />  
<meta name="robots" content="follow" />  
<script type="text/javascript">  
   var request = false;  
   try {  
     request = new XMLHttpRequest();  
   } catch (trymicrosoft) {  
     try {  
       request = new ActiveXObject("Msxml2.XMLHTTP");  
     } catch (othermicrosoft) {  
       try {  
         request = new ActiveXObject("Microsoft.XMLHTTP");  
       } catch (failed) {  
         request = false;  
       }  
     }  
   }  
  
   if (!request)  
     alert("Error initializing XMLHttpRequest!");  
  
   function getCustomerInfo(field) {  
     var field = document.getElementById(field).value;  
     var url = "writephone.php?phone=" + escape(field);  
     request.open("GET", url, true);  //true bedeutet asynchron  
     request.onreadystatechange = updatePage; //onreadystatechange = callback  
     request.send(null);  
   }  
  
   function updatePage() {  
    if (this.readyState == 4)   {  
       if (this.status == 200)  
            alert("Server is done!");  
       else if (this.status == 404)  
          alert("Request URL does not exist");  
       else  
          alert("Error: status code is " + this.status);  
      }  
  
   }  
  
  
</script>  
<title>Ajax-Test</title>  
</head>  
 <body>  
  <form method="post" action="">  
   <p>Enter your phone number:  
    <input type="text" size="14" name="phone" id="phone"  
           onchange="getCustomerInfo(this.id);" />  
   </p>  
   <p>Your order will be delivered to:</p>  
   <p>Type your order in here:</p>  
   <p><textarea name="order" rows="6" cols="50" id="order" onchange="getCustomerInfo(this.id);"></textarea></p>  
   <p><input type="submit" value="Order Pizza" id="submit" /></p>  
  </form>  
  
  <form method="post" action="">  
       <input type="text" name="testfeld" value="" />  
       <input type="submit" name="submit" value="Testfeld absenden" />  
  </form>  
 </body>  
</html>  

Markus