为什么此javascript代码未在另一个文件plugin-admin-menu.php中显示$ output1值,并且此函数是ajax调用函数

时间:2019-04-04 05:53:59

标签: ajax wordpress

我正在尝试使用ajax根据选择菜单选择的主题值显示作者和主题描述

我试图将$ output传递为ajax,但是不能这样做

get('Author');           $ description = $ mytheme-> get('Description');           ?>
      <div id="dom-target" style="display: none;">
      <?php 
        $output = $description; //Again, do some operation, get the output.
        echo htmlspecialchars($output); /* You have to escape because the result
                                           will not be valid HTML otherwise. */
       ?>

       </div>
       <div id="dom-target1" style="display: none;">
       <?php 
        $output1 = $author; //Again, do some operation, get the output.
        echo htmlspecialchars($output1); 
        ?>

      </div> 

      <?php 
      if ($output1) {

            ?>
                <script type="text/javascript">
                window.onload=function() { // when the page has loaded
                document.getElementById("themelist").onchange=function() {
                document.getElementById("cauthor").value() = '<?php echo $output1; ?>';

          }
        }
      </script>  
            <?php
        }

                wp_die();  }

    }

0 个答案:

没有答案