On alert I always get undefined... why ?
<script type="text/javascript">
$(document).ready(function(){
$("#menu ul li").click(function() {
var path = $(this).attr("href");
alert (path);
$.get(path, function(data) { $("#texte").html(data); });
return false;
});
});
</script>
</head>
<body>
<div id="wrapper">
<div id="menu">
<ul>
<li><a href="pulse/data/blocks/intro.html">Intro</a></li>
<li><a href="pulse/data/blocks/presentation.html">presentation</a></li>
<li><a href="pulse/data/blocks/pourquoi.html">pourquoi ?</a></li>
<li><a href="pulse/data/blocks/forfaits.html">forfaits</a></li>
</ul>
</div>
You need to select the a
tag.
var path = $('a', this).attr("href");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With