1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
</head>
<body>
<a id='10' href="#" rel="nofollow noopener noreferrer" target="_blank">Ma cible 1</a>
<a id='20' href="#" rel="nofollow noopener noreferrer" target="_blank">Ma cible 2</a>
<div id="contenu">
</div>
<script type="text/javascript">
$(document).ready(function(){
$("a").click(function() {
var mesData="id="+$(this).attr("id");
$.ajax({
type: "GET",
url: "fonctionsAjax.php",
data: mesData,
success: function(data){
if (data !== '') {
$(this).addClass("active");
$("#contenu").html(data);
} else {
$(this).removeClass("active");
}
});
});
return false;
});
</script>
</body>
</html> |