This problem I have could come from the server or client side, so since I am using PHP, I will put it here. (If I don't get an answer, I will post to Javascript/Ajax forum.)

According to Firebug (Net tab) I am not getting proper division between my HTTP requests and responses using Ajax.

All my requests and responses are validated XML markup on both sides.

I have the user click a Login button, and a series of three HTTP requests and responses are started. The first is a login, the second is to request a list of users, and the third a request a lists of tests. The abbreviated XML is shown below for the request and responses of just the login (authorization) and user listing requests and responses.

These requests and responses are not divided by a pause for a user action, like a form control action (button click).

The authorization request goes out via an Ajax POST method, and the authorization response comes back. Then the userlisting request goes out, again by Ajax POST method (it will always be the way) and userlisting response comes back.

The PROBLEM: I see two HTTP Request/Response POST actions in Firebug Net tab.

The second HTTP Request/Response (userlisting) seems OK. The client has parsed the XML (in responseXML property) and it is the userlisting response.

But the first HTTP Request/Response does NOT show valid parsed XML, and the reason is clear: it has as text in the response BOTH the XML response of the authorization and the userlisting one after the other. This means that the client is not "closing" the HTTP response in the first case. I do not why the userlisting is "repeated" in valid form in the second HTTP Request/Response.

The QUESTION: Is there something in PHP I should be sending in the output to the client to tell it to "close" the HTTP response so there is proper division by Ajax control on the client side?

HTML Code:
   <!-- Request #1: authorization -->
   <!-- XML prolog, including
     declaration: <?xml version .... ?>
     standalone DTD:  <![DOCTYPE ... ]]> -->
   <request type="authorization" ... >
    <!-- contained elements -->
   </request> 

   <!-- Response #1: authorization -->
   <!-- XML prolog, including
     declaration: <?xml version .... ?>
     standalone DTD:  <![DOCTYPE ... ]]> -->
   <response type="authorization" status="ok" ...>
    <!-- contained elements -->
   </response>


   <!-- Request #2: user listing -->
   <!-- XML prolog, including
     declaration: <?xml version .... ?>
     standalone DTD:  <![DOCTYPE ... ]]> -->
   <request type="listing" ctype="users" ... >
    <!-- contained elements -->
   </request> 

   <!-- Response #2: user listing -->
   <!-- XML prolog, including
     declaration: <?xml version .... ?>
     standalone DTD:  <![DOCTYPE ... ]]> -->
   <response type="listing" ctype="users" ... >
    <userlist>
     <user id="">
     ...
     </user>
     ...
    <!-- contained elements -->
   </response>