Been playing with jQuery for a while but haven't really gotten my
hands dirty with actual AJAX calls.

I have a few questions regarding a (hopefully) basic call:

$('div#myContainer').load("mySnippet.html");

mySnippet ends up being just a snippet of HTML:

<div>
   my html I want to load via jQuery
</div>

First question: If I don't have a parent container tag in my xhtml
snippet, I get the "Junk After Document Element " xml error.

Obviously, jQuery is expecting XML back. Is it OK to send XHTML?
Invalid? A foux pas? If I should just be returning XML, what should I
use on the jQuery side to transform it upon receipt?

Second question: We're trying to have the snippet be a server side
created page (like PHP) and want to pass a variable to it.

Syntax wise, this seems to work:

$('div#myContainer').load("mySnippet.php?v=1");

But if I try to concatenate the string with an actual variable:

var v = 1;
$('div#myContainer').load("mySnippet.php?v="+v);

...then it doesn't work. No error. It just doesn't load.

Again, invalid? Wrong way?

-DA

Reply via email to