views:

32

answers:

3

Hello All:

I have one MVC view page in which I show different links and I am using ThickBox to show a different page when ever one of these links is clicked. In these pages, I am using jQuery functions to do some changes, but I am not able to resolve the jquery file path on the view pages. I need to give absolute path something like "http://test.com/js/jquery.js". But is there any way to make it relative?

I also tried getting the host url and using <%=%> and <%# %> but none is working.

Any help?

Thanks Ashwani

A: 

What about trying something like:

<script src="<%=Url.Content("~/js/jquery.js")%>" type="text/javascript"></script>
CRice
A: 

Maybe you should try

<script src="/js/jquery.js" ...

instead of intellisence-generated path with ".."

<script src="../../js/jquery.js" ...

Andrew Florko
I already tried it, but it is not working
Ashwani K
It's strange. Please, run FireBug and introspect your html layout. Does it show content of js file?
Andrew Florko
No, it is not showing any js content, I have to give absolute path to run the js code
Ashwani K
A: 

This is when you run the MVC app from visual studio? If so set you're MVC application's virtual path to start at "/" instead of the default that is probably your project name.

This can be done by right-clicking on the MVC project in the solution explorer > Click Properties > Click the Web tab > Type "/" (without the quotes) in the Virtual path textbox. Then use Andrew Florko's suggestion of leading it with a slash <script src="/js/jquery.js"> </script>

alt text

used2could