How to load two divs into separate targets with JQuery?
- by Bussard
Hi all,
I'm trying to achieve two things, both of which I fail to get at.
On a server are a series of notes; all contain a div (id=ajxContent). Some notes also contain an additiona div (id=ajxHead). The ajxContent itself contains links (class=clicking) to call the next installment, hence the link destination in a variable.
This is my code:
$(document).ready(function(){
$( 'a.clicking' ).live('click', function(e){
e.preventDefault();
var theLink = $(this).attr('href');
$('#loadText').load(theLink + '#ajxContent');
$('h1').load(theLink + '#ajxHead');
});
})
Where it fails:
1) the ajxContent gets loaded into the h1 tag as well as in its intended target.
2) when I had set up the code differently, if there was no div id=ajxHead present in a note, the load would nevertheless erase the existing value in the h1 tag.
Am I on a totally wrong track here, with two load statements? Input is very welcome, thanks.