<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                以下是上述討論中的所有示例代碼段,匯編成兩個完整的代碼頁:一個用于jQuery,另一個用于PHP。 ## PHP 此代碼駐留在您的一個插件頁面上。 ``` <?php add_action('admin_enqueue_scripts', 'my_enqueue'); function my_enqueue($hook) { if( 'myplugin_settings.php' != $hook) return; wp_enqueue_script( 'ajax-script', plugins_url( '/js/myjquery.js', __FILE__ ), array('jquery') ); $title_nonce = wp_create_nonce('title_example'); wp_localize_script('ajax-script', 'my_ajax_obj', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => $title_nonce, )); } add_action('wp_ajax_my_tag_count', 'my_ajax_handler'); function my_ajax_handler() { check_ajax_referer('title_example'); update_user_meta( get_current_user_id(), 'title_preference', $_POST['title']); $args = array( 'tag' => $_POST['title'], ); $the_query = new WP_Query( $args ); echo $_POST['title'].' ('.$the_query->post_count.') '; wp_die(); // all ajax handlers should die when finished } ``` ##查詢 此代碼位于您的插件文件夾下面的文件js/myjquery.js中。 ``` jQuery(document).ready(function($) { //wrapper $(".pref").change(function() { //event var this2 = this; //use in callback $.post(my_ajax_obj.ajax_url, { //POST request _ajax_nonce: my_ajax_obj.nonce, //nonce action: "my_tag_count", //action title: this.value //data }, function(data) { //callback this2.nextSibling.remove(); //remove the current title $(this2).after(data); //insert server response }); }); }); ``` 在存儲首選項之后,將所得的帖子計數添加到所選標題。 ## 更多信息 - How To Use AJAX In WordPress - AJAX for WordPress
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看