I'm developing a template page for WordPress, I need to load an image when I click a button the path is namesite.com/wordpress/test
and I need to load an image
$("<img src='wp-content/themes/twentytwelve/images/loader.gif' class='loader' />").appendTo("#contact");
The problem is that the image isn't searched in wordpress/wp-content/themes/twentytwelve/images/loader.gif
but in wordpress/test/wp-content/themes/twentytwelve/images/loader.gif
so I have error. How can I do?
Prepend the img src with '/' to start at the root. Ex:
$("<img src='/wordpress/wp-content/themes/twentytwelve/images/loader.gif' class='loader' />").appendTo("#contact");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With