1

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 shown 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?

rem
  • 16,745
  • 37
  • 112
  • 180

2 Answers2

1

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.

Refugee
  • 483
  • 1
  • 3
  • 13
-1

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).

Alexander Beletsky
  • 19,453
  • 9
  • 63
  • 86
  • I tried to put a copy of the image to the same folder as the script itself, it's the "Script" folder. No success. – rem Jan 12 '11 at 17:32