ASP.NET MVC relative path for a jQuery spinner image
In an ASP.NET MVC project I'm trying to use jQuery spinner plugin. All's working fine except the following problem: an animated spinner.gif
is sh开发者_高级运维own only if I use an absolute path to the image as a custom parameter.
In a jquery.spinner.js
script file the default path to the image is just plain "spinner.gif". I tried to put the image to the Image folder, which is inside Content folder, to the Script folder itself, to the root of the application folder - nothing was shown.
Where I should put the image in this case or how should I define the relative path, or maybe it's the issue specific to the ASP.NET MVC routing approach?
When the script executes, it will look for the resource relative to where the current page is, not where the script resides.
If you have the image in your /Content/
folder then you can change the img src
to something like ../../Content/image.gif
where the ../
will send you back up a directory.
You should correct the jquery.spinner.js
to use relative path to animated file. Either just place file near javascript code (but this not good option).
精彩评论