Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript wordpress ajax pagination

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #245900
    ppserver
    Participant

    ‘m working on a wordpress theme (create a custom theme) and using ajax as pagination for my custom posts. sample page: HERE

    so i’m going to load pages with ajax but the problem is when i’m click for next page, instead of next page it’s returning the home page!!

    now i’m going to make it easier with a simple sample, if you can help me to call HELLO query in sample below, i will fix the whole codes with your path.

    here is my HELLO target for example (we should call it):

    this is my code in functions.php


    add_action(“wp_ajax_check_user”, “check_user”);
    add_action(“wp_ajax_nopriv_check_user”, “check_user”);

    function check_user(){

    echo 'hello';
    die();
    

    }

    and this is my code to call “HELLO” in some page:


    $.ajax({
    type: ‘POST’,
    url: “<?php echo admin_url(‘admin-ajax.php’) ?>”,
    data: {
    ‘action’: ‘check_user’
    },
    success : function(data) {
    alert(data); //FOR DEBUG
    }

    });
    

    so i can’t call hello and instead i see my home page. what’s wrong in my codes?

    thanks.

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.