ajax
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
function notes() {
|
||||
|
||||
var $link = $('#presentation a');
|
||||
$link.each(function(){
|
||||
$(this).click(function(e) {
|
||||
if ($(this).is('#ressource')) {
|
||||
e.preventDefault();
|
||||
var $url = $(this).attr("href");
|
||||
|
||||
if ($( ".side_notes" )[0]) {
|
||||
$( ".side_notes" ).remove();
|
||||
}
|
||||
|
||||
$("<div class='side_notes'/>").insertAfter("article");
|
||||
|
||||
ajax($url);
|
||||
}else{
|
||||
// nothing
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
function ajax($url) {
|
||||
$.ajax({
|
||||
url: $url,
|
||||
method: "GET",
|
||||
dataType:'html',
|
||||
async: true,
|
||||
success: function(data) {
|
||||
$(data).find('article > div:not(.__wrap_side) .__wrapper').appendTo('.side_notes');
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
notes();
|
||||
});
|
||||
Reference in New Issue
Block a user