jason
jason

Reputation: 149

How do you validate a page with AJAX content with a W3C service or similar

I have a web page that is the parent to a bunch of pages that are loaded with in using the following code.

function loadContent(elementSelector, sourceURL) {
  $(""+elementSelector+"").load("http://url.com/"+sourceURL+"");
}

To call this I would have a href like

href="javascript:loadContent('#content','page.php')"

How can you validate this using a service like the W3C markup validation service? Or for that matter grab the conent of a page in your browser. When I view source all I get is the parent regardless of what information is on the screen.

Thx

Upvotes: 2

Views: 1867

Answers (3)

Kevin Qi
Kevin Qi

Reputation: 3260

It seems like you can do this in Chrome Developer Tools in the Elements tab by right-clicking on the <html> tag and selecting Edit as HTML, which gives you copy-pasteable text of the current page state.

Keep in mind this doesn't include the DOCTYPE declaration, so that might need to be copied separately.

Upvotes: 0

Greg
Greg

Reputation: 7922

This firefox plugin uses the same algorithms to validate and has a "Validate now (HTML body after JS execution)" option:

http://users.skynet.be/mgueury/mozilla/

Upvotes: 1

o.k.w
o.k.w

Reputation: 25810

You can use W3C's Markup Validator Web Service API.

Upvotes: 0

Related Questions