You are not sending down a Content-type: text/xml header, so the browser is
interpreting your XML as plain text.

To confirm this suspicion, change your alert to:

   alert( xml );

You want the alert to display something like [object XMLwhatever]. Instead,
it will probably display the actual XML text. This indicates that it was
interpreted as plain text. Adding the header will fix that.

-Mike

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of millisami
> Sent: Monday, August 21, 2006 12:28 AM
> To: discuss@jquery.com
> Subject: [jQuery] The format of xml response
> 
> 
> The following is the interface file:
> <script language="javascript" type="text/javascript"> 
> $(document).ready(function(){
>       $("a").click(function(){
>               $.post("ajax-post-handler.php",{
>                       name: "John",
>                       address: "123 Main St."
>               }, function(xml){
>                       alert( $("name",xml).text() );
>               }
>               );
>               return(false);
>       });
> });
> </script>
> </head>
> 
> <body>
> &lt;a href="http://jquery.com/";>jQuery</a&gt;
> <div id="maindiv"></div>
> </body>
> </html>
> 
> The following is the handling file. The above form posts to 
> this file to handle.
> <?php
>       $name=$_POST['name'];
>       $address=$_POST['address'];
>       $returnXML = "<response>
>               <name>Sachin</name>
>               <address>Sagar</address>
>               </response>";
>       echo $returnXML;
> ?>
> 
> But when the alert is shown, its blank. I couldn't figure out 
> wats hapenning. I think the problem is reading back the 
> <name> in the XML format or the alert( $("name",xml).text() ); syntax.
> Is the returning XML is in the correct format?
> Is the $("name",xml).text() syntax correct?
> Help me out plz.
> Thanks
> --
> View this message in context: 
> http://www.nabble.com/The-format-of-xml-response-tf2138761.htm
> l#a5902309
> Sent from the JQuery forum at Nabble.com.
> 
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to