javascript - Hiding data that's currently in an element -
i have table posts
display info following query:
select post_id posts
i put of these results html elements this:
<?php echo '<div class="result" id="' . $post_id . '"></div>'; ?>
i don't want $post_id
public (since it's being put id), need able post_id when clicks .result
div use show more data when clicked on through javascript , php:
$(document).on("click", ".result", function(event) { event.preventdefault(); $.ajax({ url: 'get_more_info.php', type: 'post', data: { post_id: $(this).attr('id') }, success: function(data) { console.log(data); } }); });
how can keep post_id hidden public, when clicks on .result
element?
you can keep array of id's in session variable , choose on server side based on position of clicked div in general parent (e.g. ajax sends position of generated div , decide on server, id is), if think worth it. need no ids.
Comments
Post a Comment