Results 1 to 1 of 1

Thread: Check if link has been clicked and do php on a called div

  1. #1
    Join Date
    Jul 2014
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Check if link has been clicked and do php on a called div

    Hello.
    I'll introduce the problem i'm having in my way of designing a wordpress theme.
    I want a youtube iframe to start loading when a link has been clicked (not before). For that, i've managed to find the next code:

    Code:
    <a href="?link=1" name="link1">link 1</a>
    
           <div id="mainSection">
                <?php
            $link=$_GET['link'];
            if ($link == '1'){
                 echo 'youtube iframe';
            }
                ?>  
            </div>
    This prints "youtube iframe" into the div "mainSection" when the link is clicked. It is very similar to what i want to do. This is okay, but i want that the a href calls an special div (with #) in which the youtube iframe will be loaded.
    It would be like this:

    Code:
    <a href="#modal<?php echo get_the_ID(); ?>?link=1" name="link1">link 1</a>
    
    <div id="modal<?php echo get_the_ID(); ?>" class="modalmask">
           <div id="mainSection">
            <?php
            $link=$_GET['link'];
            if ($link == '1'){
                 echo 'youtube iframe';
            }
            ?>  
            </div>
    </div>
    On the a href, "#modal<?php echo get_the_ID(); ?>" is the div id adress that this link is calling (note that i've added the php to get the id of the respective post). So, this will be displayed on the called div. That's ok. But the problem is that with the addition of the div id "#modal<?php echo get_the_ID(); ?>" the php script stops recognizing the "?link=1" and therefore it no longer echoes anything. Even more specific, when i add the # character (#?link=1) it does not work.
    ¿How can i do this?
    Last edited by Rodrigo8; 12-17-2014 at 11:18 PM.

Similar Threads

  1. Replace image when link clicked
    By D13G0 in forum JavaScript
    Replies: 9
    Last Post: 11-02-2016, 12:21 AM
  2. Check a radio button when clicked on input field
    By PHP_Passion in forum JavaScript
    Replies: 1
    Last Post: 03-25-2010, 10:13 AM
  3. what link was clicked a div.
    By riptide in forum JavaScript
    Replies: 16
    Last Post: 07-23-2008, 08:17 PM
  4. Animation when a link is clicked
    By Wimpie in forum JavaScript
    Replies: 0
    Last Post: 10-10-2007, 07:17 AM
  5. Replies: 0
    Last Post: 12-05-2005, 10:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •