WP Client Ajax Login

A simple plugin that allows login to wordpress through the client's browser via AJAX.

Author:Enrico Deleo (profile at wordpress.org)
WordPress version required:3.5
WordPress version tested:4.0.4
Plugin version:0.1.7
Added to WordPress repository:31-10-2014
Last updated:11-11-2014
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:0
Rated by:0
Plugin URI:https://github.com/enricodeleo/wpClientAjaxLo...
Total downloads:464
Active installs:10+
plugin download
Click to start download

This plugin is an helper and doesn't add anything to your wordpress theme. You might want to use it in conjunction with your frontend custom code.

You can use vanilla Javascript, Angular, or any framework that suits your needs.

Here's an example with jQuery:

$.ajax({
    type: "POST",
    url: "http://yoursite.dev/wp-admin/admin-ajax.php", //change this url acoording to your wp site
    xhrFields: {
        withCredentials: true
    },
    data: {
        user: "username", //hard-coded for example purposes
        pwd: "password", //hard-coded for example purposes
        action: "clientAjaxLogin"
    },
    success: function(resp) {
        var respObj = JSON.parse( resp );
        if( respObj.success ) {
            window.location = respObj.success;
        } else {
            console.log( respObj.error );
        }
    }
});

Of course you can bind the ajax call to an event like submitting a form.