Mit*_*tro 6 wordpress jquery path
我正在为WordPress开发一个模板页面,当我点击一个按钮时namesite.com/wordpress/test
我需要加载一个图像,我需要加载一个图像
$("<img src='wp-content/themes/twentytwelve/images/loader.gif' class='loader' />").appendTo("#contact");
Run Code Online (Sandbox Code Playgroud)
问题是图像没有被搜索wordpress/wp-content/themes/twentytwelve/images/loader.gif
但是wordpress/test/wp-content/themes/twentytwelve/images/loader.gif
因为我有错误.我能怎么做?
在img src前加上'/'从根开始.例如:
$("<img src='/wordpress/wp-content/themes/twentytwelve/images/loader.gif' class='loader' />").appendTo("#contact");
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
942 次 |
最近记录: |