Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JS:
- jQuery(document).ready(function($){
- jQuery('.mappa').each(function() {
- jQuery(this).magnificPopup({
- delegate: 'a',
- type: 'inline',
- midClick: true
- });
- });
- jQuery('.mappa a').click(function(){
- // alert("The id is "+ jQuery(this).attr("data-id") );
- var post_id = jQuery(this).attr("data-name");
- jQuery.post(
- ajaxurl,
- {
- 'action': 'load_post_content',
- 'the_ID': post_id
- },
- function(response){
- jQuery('#opencomune span').html(response);
- }
- );
- return false;
- });
- });
- FUNCTION:
- add_action( 'wp_ajax_load_post_content', 'load_post_content' );
- add_action( 'wp_ajax_nopriv_load_post_content', 'load_post_content' );
- function load_post_content() {
- $the_post_id = $_POST['the_ID'];
- echo $the_post_id;
- }
- PAGINA PHP
- load_post_content();
Add Comment
Please, Sign In to add comment