In a multilanguage website when changing the img.src attribute in jQuery, it looks for base url + src which becomes something like http://localhost/app/en/resources/images/img.jpg assuming base url is http://localhost/app/en/ and src is resources/images/img.jpg
In fact the img.jpg file is not under en folder so this should be omitted from the above location.
How can I do this?

有帮助吗?

解决方案

You have two options:

  1. Give the absolute URL: http://www.google.com/...../image.png

  2. Give relative URL, two folders up: ../../image.png

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top