Inserting php into js file

前端 未结 5 1005
遇见更好的自我
遇见更好的自我 2021-01-15 01:40

I have a loading gif for the gallery on my website. In my js file I have this code to show the loader:

image: $(\"\"),         


        
5条回答
  •  野的像风
    2021-01-15 02:14

    You can create a php file instead (of your js file with all the code you already have in that js file + references to your php variables/functions) and include that in your main php file.

    Example html:

    
    
    
    
    
    
    
    

    js.php:

    var a = ;
    alert(a);
    

    will eventually output:


    
    
    
    
    
    
    

提交回复
热议问题