[jQuery] load question
[jQuery] load question
i'm stuck on a pretty basic concept.
on hovers of a's, i'm trying to load an element from another page by
url and id into a display div. i'm trying to get those 2 bits of info
from the triggering a. i'm close: the product matches a hard coded
string, but doesn't load (the way the hard coded version does)
any tips at all (other than "consult the docs"--i've tried, i'm
learning.) on doing this, or streamlining my caveman work will be
insanely appreciated. thanks!
$(document).ready(function() {
var defHref;
var defHrefSplit;
var defUrl;
var defId;
var defList;
$("a").hover(
// over
function () {
defHref = $(this).attr("href");
defHrefSplit = defHref.split('#');
defUrl = defHrefSplit[0];
defId = "#"+defHrefSplit[1];
$("#display").append("<span id='def'></span>");
// seems to eval correctly, but doesn't work
$("#def").load(defUrl defId));
// the hard coded version (works)
//$("#def").load("dictionary.html #puppy");
},
// out
function () {
$("#display").find("#def").remove();
}
);
});
an example a tag:
<a href="dictionary.html#puppies">puppies</a>
dev url:
http://root-interactive.com/problems/