<h2>添加特色</h2>
<label for="feature">特色：</label>
<input id="feature" type="text">
<input type="submit" id="submit" class="button">
<script>
    (function ($) {
        $(document).ready(function () {
            $('#submit').click(function () {
                var name = $('#feature').val();
                if (name.trim() != '') {
                    $.ajax({
                        type: 'POST',
                        url: '{{ url }}/wp-admin/admin-ajax.php/',
                        data: 'action=add_feature&name=' + name,
                        success: function (data) {
                            if (data) {
                                alert('添加成功');
                            } else {
                                alert('添加失败');
                            }
                        }
                    });
                } else {
                    alert('请输入特色');
                }
            });
        });
    })(jQuery);
</script>