Is it okay to use PHP inside a jQuery script?

前端 未结 7 1476
误落风尘
误落风尘 2021-02-20 03:56

For example:

$(document).ready(function(){
    $(\'.selector\').click(function(){
        
    });
});
         


        
7条回答
  •  时光取名叫无心
    2021-02-20 04:23

    If you are trying to bound some PHP code with the click event then this is impossible in the way you are trying and PHP code will be executed as soon as page load without waiting for a click event.

    If you are trying to generate final javascript or jquery code using PHP then this is okay.

提交回复
热议问题