Reputation: 1852
I generate links to select galeriecategories to show in the frontend. It works all fine, but i just can't figure out how to submit this link to the iframe with the id submitter and name submitter...with jquery it returns my galerie
I generate my links like that...the first one is always #toggleRefCat0
echo "<a href=\"show.php?action=showGalerie&gaid=0&type=$type&view=$view\" target=\"submitter\" class=\"toggleRefCat\" id=\"toggleRefCat0\" >All</a>";
So I tried this:
$(document).ready(function(){
//$('#toggleRefCat0').click();
//$('#toggleRefCat0').toggle();
var thisCVAR = $('#toggleRefCat0').attr('href');
$('#submitter').load(thisCVAR);
});
With a REAL click on that link it loads all perfectly...but with jquery click, toggle and the .load it doesn´t work...
The only solution (which comes to my mind) that would work 100% would be: generating a form and submit this with jquery...but that´s way to complex...i think there must be a simpler solution....
Upvotes: 0
Views: 341
Reputation: 9348
You can remove the target
from your hyperlink, which will become useless, and then set the iframe
src
value with jQuery
:
$(document).ready(function(){
$('#toggleRefCat0')on('click', function(e) {
// Stop the link default behaviour.
e.preventDefault();
// Set the iframe src with the clicked link href.
$('#submitter').attr('src', $(this).attr('href'));
});
});
Upvotes: 1