JQuery Load() syntax - Changing data source on mouseenter
Posted
by Andrew Parisi
on Stack Overflow
See other posts from Stack Overflow
or by Andrew Parisi
Published on 2010-06-16T15:20:18Z
Indexed on
2010/06/16
15:22 UTC
Read the original article
Hit count: 219
jQuery
|jquery-ajax
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 matching cName
?
Thanks for the help!
© Stack Overflow or respective owner