Have you worked with ajax on two plain php pages? Its pretty much the same way, jquery made it simple.
create page one.
create page two the same way you create other wordpress "pages".
Include jquery on page one header.php
call page two and pass parameters (refer to this http://api.jquery.com/jQuery.ajax/)
decide what to do with the data you are getting I can see right now you are sending it to browser console.

Also you can use the console to debug your javascript code
regards



On Thu, Nov 7, 2013 at 5:25 PM, Ken Muturi <muturiken@gmail.com> wrote:
has anyone tried Ajax in wordpress before coz it doesnt seem to be working for me.....
i followed this tut.  http://blog.parallax.lk/ajax-in-wordpress/


here is my code

function register_my_theme_scripts()
{   
   wp_register_script( 'ajax_call_scripts', get_template_directory_uri() . '/assets/js/pages/ajax.js', array('jquery'), false, true );
   wp_enqueue_script( 'ajax_call_scripts' );

    wp_localize_script( 'ajax_call_scripts', 'ajax_params', array(
        'ajaxurl' => admin_url( 'admin-ajax.php' ),
        'postCommentNonce' => wp_create_nonce( 'ajax_params' ),
        'action_call' => 'my_action',
        )
    );
}

// this hook is fired if the current viewer is not logged in & logged in
do_action( 'wp_ajax_nopriv_my_action', 'theme_ajax_call');
do_action( 'wp_ajax_my_action', 'theme_ajax_call');
add_action( 'wp_enqueue_scripts', ' register_my_theme_scripts' );

function theme_ajax_call()
{   
    ob_clean();
    echo 'here';
    die();
}


// the on ajax.js

$.ajax({
    type : "POST",
    url : ajax_params.ajaxurl,
    action : ajax_params.action_call,
    data : {
        'postCommentNonce' : crimesmap_ajax.postCommentNonce,
        'value' : $('#form_field').val().trim()
    },
    success: function(ret) {
           console.log(ret);
    }
});





_______________________________________________
skunkworks mailing list
skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke