This question already has answers here:
What is the difference between client-side and server-side programming?
                            
                                (4个答案)
                            
                    
                去年关闭。
        

    

任何帮助将不胜感激。我只想在php代码中分配javascript变量。

从上面的代码..需要将var gtitle分配给do_shortcode()

<script type="text/javascript">
    jQuery(document).ready(function($) {
        $(document).on('click', '.map' , function(){
            var gtitle = $(this).data("fpid");
            <?php $data = do_shortcode('+gtitle+'); ?>
        }
    }
</script>

最佳答案

可能是这样的:

var gtitle = <?php echo do_shortcode() ?>;

09-07 17:34