[jQuery] Advice on link usage (functions, livequery?)
Hi, I'm not very good with javascript, but here goes! Title might be
somewhat weird...
I'm building a map like thing and need some advice on how the links to
cities - mainly how to navigate the map - should be.
I'm currently just assigning the "link" via an ID like this;
<a id="berlin" class="move" href="#">To Berlin</a>
This is inside an ajax loaded area, som I'm also using livequery to
make this work;
$('#map a.move').livequery('click', function(event) {
var whatarea = this.id;
$.ajax({
url: 'map.php',
data: { area: whatarea },
success: function(msg) {
$('#map').html(msg);
}
});
return false;
});
This works, but I'd like to pass on some more variables, not just
id=berlin.
I've tried with something like
function moveMap(whatarea,extravar,anothervar) {
// same ajax call as above
}
But then I'd have to use links like;
<a href="javascript:moveMap('berlin','extra','somethingmore');">To
Berlin</a>
I really prefer the other way, and I don't really want the links to be
"visible". I'd rather have it hidden, even if it's no important data.
Are there any disadvantages using the the above alternative? When
using livequery, I probably slows down a bit as it has to go through
the data (I think). But the above one? And is it possible to like,
make the links more subtle like with the ID-way?
Or do you recommend any other ways?
Thanks in advance =)