title: Parsing XML returned from SOAP Jquery plugin
body: <p>Apologise.  I know this type of question was asked several times and was answered.  I really spent a complete day on this and cant find any solution.</p>
  
  <p>I am using Jquery SOAP API to submit a WSDL request and get the response.  I am able to submit the request and also I am able to receive the response.</p>
  
  <p><strong>AJAX code</strong></p>
  
  <pre><code>$(document).ready(function() {
      $('#btn_click').click(function(e) {
          // stop the form to be submitted...
          e.preventDefault();
          var data = $('#txt_userid').val();
          data = formUserNameReqXML(data);
          $.soap({
              url: 'service ws*l url',
              method: 'getUserName',
              data: data,
              success: function(xml) {
                  $('#feedback').text(xml);
                  alert($(xml).find('username').text());
              },
              error: function(SOAPResponse) {
                  $('#feedback').text(SOAPResponse.toString());
              }
          });
      });
  });
  </code></pre>
  
  <p>The returned XML is as given below</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="urn:localhost-jeema"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
    &lt;SOAP-ENV:Body&gt;
      &lt;ns1:getUserNameResponse&gt;
        &lt;username xsi:type="xsd:string"&gt;SUCCESS&lt;/username&gt;
      &lt;/ns1:getUserNameResponse&gt;
    &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>I want to get the value inside the 'username' tag.  As in the above AJAX code the 'feedback' element is loaded with the response XML string (without line breaks) but the alert message is displaying null. Why the value received inside alert is empty?</p>
  
  <p>The interesting part is that the same XML parsed perfect when I try with simple AJAX as given below.</p>
  
  <pre><code>$(document).ready(function() {
    $('#btn_click').click(function(e) {
      $.ajax({
      type: "POST",
      url: "response.xml",
      dataType: "xml",
      success: function(xml) {
        alert($(xml).find('username').text());
      },
      error:function() { alert('outside'); }
      });
    });
  });
  </code></pre>
  
  <p>Need some experts advice on this.</p>