[wordpress插件] AHAXAHAX

wordpress 插件 文章 2020-02-12 10:40 532 0 全屏看文

AI助手支持GPT4.0

评分

0

0

描述

AHAX is a drop-in solution that allows theme or plug-in developers to take advantage of a very simple and streamlined way of making AJAX requests.

AHAX是一种嵌入式解决方案,允许主题或插件开发人员利用非常简单且精简的方式进行AJAX请求。

The goal of this plugin is to make the process of setting up an AJAX request as simple as possible.

此插件的目标是使设置AJAX请求的过程尽可能简单。

This plugin centers AJAX requests around an “action.” This action is “bound” to a function (handler) on the back-end and called to from front-end via a custom JavaScript class method — this process is demonstrated below

此插件将AJAX请求集中在一个“动作”周围。此动作“绑定”到后端的函数(处理程序),并通过自定义JavaScript类方法从前端调用到该动作-如下所示

.

Back-End

后端

ahax::bind( 'get_random_number', 'generate_number' );

  ahax :: bind('get_random_number','generate_number');

function generate_number($output) { $max = abs( ( int ) $_POST['max'] );

函数generate_number($ output){$ max = abs((int)$ _POST ['max']);

$output = mt_rand( 0 , ( $max <= 1000 ? $max : 1000 ) );

$ output = mt_rand(0,($ max <= 1000?$ max:1000));

return $output;

返回$ output;

}

}

Front-End

前端

var ahax = new AHAX();

  var ahax = new AHAX(); 

ahax.post( 'get_random_number', { max : 1000 }, function( response ) { jQuery( '#ahax_number' ).html( response ); });

ahax.post('get_random_number',{max:1000},function(response){jQuery('#ahax_number').html(response);});

Website

网站

http://dan.doezema.com/2011/04/ahax-wordpress-plugin

http://dan.doezema.com/2011/04/ahax-wordpress-plugin

Author

作者

Daniel Doezema

丹尼尔·多兹玛

安装步骤

    1. Upload ahax plugin directory to the /wp-content/plugins/ directory.
    2. ahax 插件目录上传到 / wp-content / plugins / 目录。

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

下载地址

https://downloads.wordpress.org/plugin/ahax.1.0.zip

https://downloads.wordpress.org/plugin/ahax.1.0.zip

-EOF-

AI助手支持GPT4.0