I have an issue with class and ajax :
Hi have several .megavideo div on my page.
<div class="megavideo">
<img alt="video" src="https://i1.ytimg.com/vi/6TDQOEATSik/hqdefault.jpg">
<a href="#nolink" onclick="javascript:play('note', 33);">
<div class="maxiplay">
<div class="titremaxiplay">
CLICK TO PLAY
</div>
<img class="play" alt="play" src="kit/play.png">
</div>
</a>
</div>
Inside the div, there a link with a javascript function. This javascript function goal is to refresh the .megavideo div around the link (and just that one)
My function :
function play(what, who){
$.ajax({
type: "POST",
url: "launchvideo.php",
data: "what="+what+"&who="+who,
cache: false,
success: function(html){
$(".megavideo").html(html);
}
});
}
For now, logically the function refresh every .megavideo divs. How can i use (this) on my function to target only the .megavideo link parents ?
The closest answer i found here is that : Get ID of clicked on element in function But it's not exactly what i'm looking for.
Thanks everyone ! Thomas