ajax
This commit is contained in:
@@ -1,14 +1,33 @@
|
||||
var $Sba = $('.sidebar-right a');
|
||||
var $Sbsvg = $('.sidebar-right svg');
|
||||
var $culturelle = $('#text_figli p > a:nth-of-type(3)');
|
||||
|
||||
function addclass() {
|
||||
$Sba.hover(function() {
|
||||
$(this).addClass("hover");
|
||||
}, function() {
|
||||
$(this).removeClass("hover");
|
||||
function ajax() {
|
||||
$.ajax({
|
||||
url : 'projets/culturelle.html', // La ressource ciblée
|
||||
type : 'GET', // Le type de la requête HTTP
|
||||
dataType:'html',
|
||||
success: function(data) {
|
||||
$(data).find('.card').insertAfter($culturelle);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function deploy() {
|
||||
$culturelle.click(function(e){
|
||||
$(this).addClass('marg');
|
||||
e.preventDefault()
|
||||
|
||||
var $detectCard = $('#text_figli > p > .card');
|
||||
if ($detectCard[0]) {
|
||||
console.log(true);
|
||||
$(".card").remove();
|
||||
$(this).removeClass("marg");
|
||||
}else{
|
||||
console.log(false);
|
||||
ajax();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
addclass();
|
||||
deploy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user