JQuery Load() syntax - Changing data source on mouseenter
Hey everyone. I've written this simple function that is supposed to load a portion of an XML file on mouseenter. It works fine when I specify the data source explicitly, shown below.
I have a number of '.invest-port-thumb' divs, each with a unique link.
The following code works fine—but it loads the whole XML file—and I only want a portion:
$(document).ready(function() {
$('.invest-port-thumb a').mouseenter(function() {
$('#slider-name').load(this.href);
});
});
This code also works fine—loading only the 'cName' portion that I want it to load...Except that this code refers to one of the files, instead of the value of this.href
.
$(document).ready(function() {
$('.invest-port-thumb a').mouseenter(function() {
$('#slider-name').load('port/atd.xml cName');
});
});
I guess what I'm saying, syntax wise—How can I combine this.href
and the data matchin开发者_运维知识库g cName
?
Thanks for the help!
$('#slider-name').load(this.href + ' cName'); // watch out for the space...
精彩评论