Tags

,


In wordpress site while you add ajax function to modify html content you can do it in fancy way like adding some jquery effect. so user can see updated contents in site.

<script type="text/javascript">
jQuery(document).ready(function() {
    jQuery('.ajaxlink').click(function(e) {
        e.preventDefault();
        var postid = jQuery(this).data('postid');
        jQuery.ajax({
            type: 'POST',
            url: "http://your-wordpress-site.com/wp-admin/admin-ajax.php",
            data: {
                action: 'action_show-post-extra-content',
                postid: postid
            },
            success: function(data) {
	        //show ajax output with fade effect
                jQuery(".ajax-output-div").hide().html(data).fadeIn();
            }
        });
    });
});
</script>