Error: uncaught exception: [Exception... "An invalid or illegal string was specified"
<p>This two errors I get in the Firefox error console:</p>

<pre><code>Error: Incorrect document format
Source file: 
Row 1, column 45
Source code:
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;

Error: uncaught exception: [Exception... "An invalid or illegal string was specified"  code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)"  location: "http://127.0.0.1/WebLibThirdParty/JavaScript//jquery.js Line: 112"]
</code></pre>

<p>My jquery code is simple:</p>

<pre><code>$(document).ready(function() {
        // when the #guest_details is clicked
    $('#guest_details').click(function() {

        var postedData = $('#guest-details-dialog-contents form').serialize();
        var uri = '/';
        $.ajax({
            type: 'POST',
            data: postedData,
            url: uri,
            success: function(data) {
                // this works
                            alert(data);
                            // this doesn't work
                alert($(data).html());
            }
        });

        return false;

    });
});
</code></pre>

<p>As you can see, the problematic line is:</p>

<pre><code>alert($(data).html());
</code></pre>

<p>In the ajax callback. The PHP script returns valid XHTML (served as XML) so I am buffled by this issue.</p>

<p>EDIT:</p>

<p>Ok. The problem is that AJAX returns messed up XHTML. It changes tags to HTML:</p>

<pre><code>&lt;br /&gt; becomes &lt;br&gt;
&lt;input type="text" name="someInput" /&gt; becomes &lt;input type="text" name="someInput"&gt;
and so on
</code></pre>
