jQuery .load() XHTML issue

Posted by Urfe on Stack Overflow See other posts from Stack Overflow or by Urfe
Published on 2010-01-24T03:54:10Z Indexed on 2010/04/28 1:13 UTC
Read the original article Hit count: 524

Filed under:
|
|

I am having some strange problems loading content from another XHTML page via jQuery. When the second page I try to load from is served as XHTML I get the below error. I don't know if it helps but both documents validate when I get the error.

Uncaught Error: NO_MODIFICATION_ALLOWED_ERR: DOM Exception 7

Currently the header on the second page I load from is:

<?xml version="1.0" encoding="iso-8859-1" ?>
<!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" xml:lang="en">

<head>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <meta name="language" content="en" />  
 <title>some title</title>
 <!-- CSS & Javascript included here -->
</head>

The content type is set as:

application/xhtml+xml;charset=iso-8859-1

Interestingly, when I remove all the XHTML stuff from the header and stop setting the content type the error does not occur and everything works great.

The load process currently looks like the below. It works fine when everything is plain HTML.

$('#overpage').find(".wrap").load(this.getTrigger().attr("href")+" #op").show();

I'm curious why the process only does not work when the second page I load from is XHTML. I don't want to serve the page as just plain HTML and am looking for advice on what I am doing wrong. Both pages validate and I'm really scratching my head here. Many thanks!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about XHTML