简体   繁体   中英

How to dynamically load Content in Div with Jquery? (Code given)

I want to have a overlay over my content site. So if somebody clicks on a link a article is loaded into the covering overlay Div

Everything is working fine except the output is not working properly.

<script language="javascript">

    $( ".iddd" ).click(function() {
    var aid = $(this).prop('id');
    $('#overlaycontent').load('http://www.example.com/overlay.php', { id: aid });

    });

Test PHP Script:

<?php 

include ("config.php");
$ID = $_POST['id'];

echo $ID;

?>

That´s how my links are placed:

<a class="iddd" href="#overlay" id="6337cab172">

The id should be loaded into the script so I can access my articles but i guess the Jquery is not working properly.

I looked at this overlay with dynamic php content the right way?

but still it doesnt post the ID properly!

Not sure what is in config.php and if missing that could cause your problem, but to include a file, you don't use parenthesis, but only quotes, so, instead of

include ("config.php");

just

include "config.php";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM