How do you use Wordpress functions from AJAX calls. I have checked out the documentation for creating plug ins which use ajax, however i could not learn how to apply that to regular pages and posts.

Can there be a good way to simply load everything without needing their API? I've my way I love to do ajax and prefer to not use their stuff.

This can be a fluff version of my code:

Javascript (jQuery):

$('.action.next_posts').click(function() {
        var last_date = $(this).attr('title');
        //alert();
        $.ajax({
            url: WP_DIR+'functions.php?action=get_next_posts',
            type: 'POST',
            data: {date : last_date},

            success: function(response) {
                alert(response);
            },

            error: function(error) {
                alert("error");
            }
        });

    });

Functions.php (PHP):

// AJAX controller

if(isset($_GET['action'])) {
    require_once('../../../wp-config.php');

    require_once('../../../wp-includes/classes.php');
    require_once('../../../wp-includes/functions.php');

    wp();
    echo 'ok';
    echo bloginfo('name'); // NOT WORKING. TRIED adding actions..
    return;
}

The next solution should work. You will proceed and publish straight to the WordPress installation and intercept the request before WordPress does all of the querying it would normally do. You will find some caveats for this method, one of these since some caching techniques will hinder it, however it should work fairly well for the reasons.

Besides, you stated you did not desire to use the required WordPress API, so this ought to be just made for you.

JavaScript:

jQuery(document).ready(function($) {
    $('.action.next_posts').click(function(event) {
        event.preventDefault();
        var last_date = $(this).attr('title');
        $.ajax({
            url: '/',
            type: 'post',
            data: {date : last_date, action: 'get_next_posts'},

            success: function(response) {
                alert(response);
            },

            error: function(error) {
                alert("error");
            }
        });

    });
});

functions.php

add_action('parse_request','my_request_parser');
function my_request_parser($wp) {
    if( 'get_next_posts' == $_POST['action'] ) {
        echo 'ok';
        bloginfo('name');
        exit();
    }
}