enricodeleo/wp-client-ajax-login
最新稳定版本:0.1.8
Composer 安装命令:
composer require enricodeleo/wp-client-ajax-login
包简介
A simple plugin that allows login to wordpress through the client's browser via AJAX.
关键字:
README 文档
README
A simple helper plugin that allows login to wordpress through the client's browser via AJAX.
How to install
Composer
If you're using Composer to manage your codebase add this plugin to your dependencies running:
composer require enricodeleo/wp-client-ajax-login 0.1.8
Or manually add it to your composer.json:
"require": { "enricodeleo/wp-client-ajax-login": "0.1.8" }
Legacy way
Download this repo as a zip file and extract it to your wp-content/plugins directory.
OR
Install this plugin via the official Wordpress Plugin registry https://wordpress.org/plugins/wp-client-ajax-login/admin/.
Usage
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.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-10-30