I have some link with parameter:
<a href="index.php?page=home&lang=en" class="flag">
<img src="./images/flags/en.png" class="flag_on" alt="en" title="en">
</a>
and how to parse $lang parameter to index.php by clicking on link with jQuery/Ajax ?
My working example:
$(".flag").click(function(event) {
event.preventDefault();
$.get(this.href, function(data) {
location.reload();
});
});
$(".flag_on").click(function(){
$.get($(this).parent().attr("href"), function(data) {
$('.result').html(data);
alert('Load was performed.');
});
});
Or you can modify HTML code to use click event for the link but not for the image:
<a href="index.php?page=home&lang=en" class="flag">
<img src="./images/flags/en.png" class="flag_on" alt="en" title="en">
</a>
$(".flag").click(function(event) {
event.preventDefault();
$.get(this.href, function(data) {
$('.result').html(data);
alert('Load was performed.');
});
});