lundi 5 octobre 2015

Initial load of category jquery

I've succesfully implemented this jquery I found in another thread, using ajax to load different categories.. Problem is that posts are only loaded after a click - i'd like to display one category on page load, but have not been succesful.. Any ideas? Thanks!

<script>
function cat_ajax_get(catID) {
    jQuery("a.ajax").removeClass("current");
    jQuery("a.ajax").addClass("current fadein");
    jQuery("#loading-animation").show();
    var ajaxurl = '/wp-admin/admin-ajax.php';
    jQuery.ajax({
        type: 'POST',
        url: ajaxurl,
        data: {"action": "load-filter", cat: catID },
        success: function(response) {
            jQuery("#category-post-content").html(response);
            jQuery("#loading-animation").hide();
            return false;
        }
    });
}   </script>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire